|
|
|
|
@ -79,17 +79,6 @@ def check_python_version():
|
|
|
|
|
major = ver.major
|
|
|
|
|
minor = ver.minor
|
|
|
|
|
|
|
|
|
|
# Abort on very old Python 2 versions.
|
|
|
|
|
if (major, minor) < (2, 7):
|
|
|
|
|
print(
|
|
|
|
|
"repo: error: Your Python version is too old. "
|
|
|
|
|
"Please use Python {}.{} or newer instead.".format(
|
|
|
|
|
*MIN_PYTHON_VERSION_SOFT
|
|
|
|
|
),
|
|
|
|
|
file=sys.stderr,
|
|
|
|
|
)
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
# Try to re-exec the version specific Python 3 if needed.
|
|
|
|
|
if (major, minor) < MIN_PYTHON_VERSION_SOFT:
|
|
|
|
|
# Python makes releases ~once a year, so try our min version +10 to help
|
|
|
|
|
@ -134,16 +123,7 @@ def check_python_version():
|
|
|
|
|
reexec("python3")
|
|
|
|
|
|
|
|
|
|
# We're still here, so diagnose things for the user.
|
|
|
|
|
if major < 3:
|
|
|
|
|
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:
|
|
|
|
|
if (major, minor) < MIN_PYTHON_VERSION_HARD:
|
|
|
|
|
print(
|
|
|
|
|
"repo: error: Python 3 version is too old; "
|
|
|
|
|
"Please use Python {}.{} or newer.".format(
|
|
|
|
|
@ -170,7 +150,7 @@ if not REPO_REV:
|
|
|
|
|
BUG_URL = "https://issues.gerritcodereview.com/issues/new?component=1370071"
|
|
|
|
|
|
|
|
|
|
# increment this whenever we make important changes to this script
|
|
|
|
|
VERSION = (2, 39)
|
|
|
|
|
VERSION = (2, 40)
|
|
|
|
|
|
|
|
|
|
# increment this if the MAINTAINER_KEYS block is modified
|
|
|
|
|
KEYRING_VERSION = (2, 3)
|
|
|
|
|
@ -274,19 +254,8 @@ import optparse
|
|
|
|
|
import re
|
|
|
|
|
import shutil
|
|
|
|
|
import stat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if sys.version_info[0] == 3:
|
|
|
|
|
import urllib.error
|
|
|
|
|
import urllib.request
|
|
|
|
|
else:
|
|
|
|
|
import imp
|
|
|
|
|
|
|
|
|
|
import urllib2
|
|
|
|
|
|
|
|
|
|
urllib = imp.new_module("urllib")
|
|
|
|
|
urllib.request = urllib2
|
|
|
|
|
urllib.error = urllib2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
repo_config_dir = os.getenv("REPO_CONFIG_DIR", os.path.expanduser("~"))
|
|
|
|
|
@ -1525,6 +1494,14 @@ def main(orig_args):
|
|
|
|
|
if reqs:
|
|
|
|
|
reqs.assert_all()
|
|
|
|
|
|
|
|
|
|
# Python 3.11 introduces PYTHONSAFEPATH and the -P flag which, if enabled,
|
|
|
|
|
# does not prepend the script's directory to sys.path by default.
|
|
|
|
|
# repo relies on this import path, so add directory of REPO_MAIN to
|
|
|
|
|
# PYTHONPATH so that this continues to work when PYTHONSAFEPATH is enabled.
|
|
|
|
|
python_paths = os.environ.get("PYTHONPATH", "").split(os.pathsep)
|
|
|
|
|
new_python_paths = [os.path.join(rel_repo_dir, S_repo)] + python_paths
|
|
|
|
|
os.environ["PYTHONPATH"] = os.pathsep.join(new_python_paths)
|
|
|
|
|
|
|
|
|
|
ver_str = ".".join(map(str, VERSION))
|
|
|
|
|
me = [
|
|
|
|
|
sys.executable,
|
|
|
|
|
|