mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
launcher: abort if python3 reexec failed
We don't support Python 2 anymore, so stop allowing it to fallback. If we try to run the latest version with Python 2, it just hits syntax errors which confuses people. Dump a clear error message that their system is too old and give up. Bug: https://crbug.com/gerrit/13795 Change-Id: I38c243cf09502f670cddad72c2d0148f736515e0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/292443 Reviewed-by: Michael Mortensen <mmortensen@google.com> Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
47692019b3
commit
ce9b6c43b2
7
repo
7
repo
@ -103,8 +103,8 @@ def check_python_version():
|
|||||||
break
|
break
|
||||||
reexec('python{}.{}'.format(min_major, min_minor - inc))
|
reexec('python{}.{}'.format(min_major, min_minor - inc))
|
||||||
|
|
||||||
# Try the generic Python 3 wrapper, but only if it's new enough. We don't
|
# Try the generic Python 3 wrapper, but only if it's new enough. If it
|
||||||
# want to go from (still supported) Python 2.7 to (unsupported) Python 3.5.
|
# isn't, we want to just give up below and make the user resolve things.
|
||||||
try:
|
try:
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
['python3', '-c', 'import sys; '
|
['python3', '-c', 'import sys; '
|
||||||
@ -122,9 +122,10 @@ def check_python_version():
|
|||||||
|
|
||||||
# We're still here, so diagnose things for the user.
|
# We're still here, so diagnose things for the user.
|
||||||
if major < 3:
|
if major < 3:
|
||||||
print('repo: warning: Python 2 is no longer supported; '
|
print('repo: error: Python 2 is no longer supported; '
|
||||||
'Please upgrade to Python {}.{}+.'.format(*MIN_PYTHON_VERSION_HARD),
|
'Please upgrade to Python {}.{}+.'.format(*MIN_PYTHON_VERSION_HARD),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
elif (major, minor) < MIN_PYTHON_VERSION_HARD:
|
elif (major, minor) < MIN_PYTHON_VERSION_HARD:
|
||||||
print('repo: error: Python 3 version is too old; '
|
print('repo: error: Python 3 version is too old; '
|
||||||
'Please use Python {}.{} or newer.'.format(*MIN_PYTHON_VERSION_HARD),
|
'Please use Python {}.{} or newer.'.format(*MIN_PYTHON_VERSION_HARD),
|
||||||
|
Loading…
Reference in New Issue
Block a user