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>
diff --git a/repo b/repo
index dae37bd..9b4ab11 100755
--- a/repo
+++ b/repo
@@ -103,8 +103,8 @@
break
reexec('python{}.{}'.format(min_major, min_minor - inc))
- # Try the generic Python 3 wrapper, but only if it's new enough. We don't
- # want to go from (still supported) Python 2.7 to (unsupported) Python 3.5.
+ # Try the generic Python 3 wrapper, but only if it's new enough. If it
+ # isn't, we want to just give up below and make the user resolve things.
try:
proc = subprocess.Popen(
['python3', '-c', 'import sys; '
@@ -122,9 +122,10 @@
# We're still here, so diagnose things for the user.
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),
file=sys.stderr)
+ sys.exit(1)
elif (major, minor) < MIN_PYTHON_VERSION_HARD:
print('repo: error: Python 3 version is too old; '
'Please use Python {}.{} or newer.'.format(*MIN_PYTHON_VERSION_HARD),