diff options
author | Mike Frysinger <vapier@google.com> | 2019-06-13 01:48:12 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2020-02-05 21:32:02 +0000 |
commit | 3ba716f3823c010a9788077d9515c26db5d58f11 (patch) | |
tree | 0a2aedbda1a4940dec2fe63d513935e847f9e106 /subcmds/init.py | |
parent | 655aedd7f34d9f2ff6dd3cb77c080addd0f06c4b (diff) | |
download | git-repo-3ba716f3823c010a9788077d9515c26db5d58f11.tar.gz |
repo: try to reexec self with Python 3 as needed
We want to start warning about Python 2 usage, but we can't do it
simply because the shebang is /usr/bin/python which might be an old
version like python2.7.
We can't change the shebang because program name usage is spotty at
best: on some platforms (like macOS), it's not uncommon to not have
a `python3` wrapper, only a major.minor one like `python3.6`. Using
python3 wouldn't guarantee a new enough version of Python 3 anyways,
and we don't want to require Python 3.6 exactly, just that minimum.
So we check the current Python version. If it's older than the ver
of Python 3 we want, we search for a `python3.X` version to run. If
those don't work, we see if `python3` exists and is a new enough ver.
If it's not, we die if the current Python 3 is too old, and we start
issuing warnings if the current Python version is 2.7. This should
allow the user to take a bit more action by installing Python 3 on
their system without having to worry about changing /usr/bin/python.
Once we require Python 3 completely, we can simplify this logic a bit
by always bootstrapping up to Python 3 and failing with Python 2.
We have a few KI with Windows atm though, so keep it disabled there
until the fixes are merged.
Bug: https://crbug.com/gerrit/10418
Change-Id: I5e157defc788e31efb3e21e93f53fabdc7d75a3c
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/253136
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/init.py')
0 files changed, 0 insertions, 0 deletions