diff options
author | Jason R. Coombs <jaraco@google.com> | 2023-10-31 16:49:26 -0400 |
---|---|---|
committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-11-01 17:02:34 +0000 |
commit | d32b2dcd1530a1cf30a4da380ec7388022b4a2bf (patch) | |
tree | 1d0a2680576a69e5f94d2e102f258e9119312986 | |
parent | b32ccbb66bb16965ecb8b4e266c4e45186636c1b (diff) | |
download | git-repo-d32b2dcd1530a1cf30a4da380ec7388022b4a2bf.tar.gz |
repo: Remove unreachable code.
Change-Id: I41371feb88c85e9da0656b9fab04057c22d1dcf4
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/391514
Tested-by: Jason R. Coombs <jaraco@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Commit-Queue: Jason R. Coombs <jaraco@google.com>
-rwxr-xr-x | repo | 39 |
1 files changed, 4 insertions, 35 deletions
@@ -79,17 +79,6 @@ def check_python_version(): | |||
79 | major = ver.major | 79 | major = ver.major |
80 | minor = ver.minor | 80 | minor = ver.minor |
81 | 81 | ||
82 | # Abort on very old Python 2 versions. | ||
83 | if (major, minor) < (2, 7): | ||
84 | print( | ||
85 | "repo: error: Your Python version is too old. " | ||
86 | "Please use Python {}.{} or newer instead.".format( | ||
87 | *MIN_PYTHON_VERSION_SOFT | ||
88 | ), | ||
89 | file=sys.stderr, | ||
90 | ) | ||
91 | sys.exit(1) | ||
92 | |||
93 | # Try to re-exec the version specific Python 3 if needed. | 82 | # Try to re-exec the version specific Python 3 if needed. |
94 | if (major, minor) < MIN_PYTHON_VERSION_SOFT: | 83 | if (major, minor) < MIN_PYTHON_VERSION_SOFT: |
95 | # Python makes releases ~once a year, so try our min version +10 to help | 84 | # Python makes releases ~once a year, so try our min version +10 to help |
@@ -134,16 +123,7 @@ def check_python_version(): | |||
134 | reexec("python3") | 123 | reexec("python3") |
135 | 124 | ||
136 | # We're still here, so diagnose things for the user. | 125 | # We're still here, so diagnose things for the user. |
137 | if major < 3: | 126 | if (major, minor) < MIN_PYTHON_VERSION_HARD: |
138 | print( | ||
139 | "repo: error: Python 2 is no longer supported; " | ||
140 | "Please upgrade to Python {}.{}+.".format( | ||
141 | *MIN_PYTHON_VERSION_HARD | ||
142 | ), | ||
143 | file=sys.stderr, | ||
144 | ) | ||
145 | sys.exit(1) | ||
146 | elif (major, minor) < MIN_PYTHON_VERSION_HARD: | ||
147 | print( | 127 | print( |
148 | "repo: error: Python 3 version is too old; " | 128 | "repo: error: Python 3 version is too old; " |
149 | "Please use Python {}.{} or newer.".format( | 129 | "Please use Python {}.{} or newer.".format( |
@@ -170,7 +150,7 @@ if not REPO_REV: | |||
170 | BUG_URL = "https://issues.gerritcodereview.com/issues/new?component=1370071" | 150 | BUG_URL = "https://issues.gerritcodereview.com/issues/new?component=1370071" |
171 | 151 | ||
172 | # increment this whenever we make important changes to this script | 152 | # increment this whenever we make important changes to this script |
173 | VERSION = (2, 39) | 153 | VERSION = (2, 40) |
174 | 154 | ||
175 | # increment this if the MAINTAINER_KEYS block is modified | 155 | # increment this if the MAINTAINER_KEYS block is modified |
176 | KEYRING_VERSION = (2, 3) | 156 | KEYRING_VERSION = (2, 3) |
@@ -274,19 +254,8 @@ import optparse | |||
274 | import re | 254 | import re |
275 | import shutil | 255 | import shutil |
276 | import stat | 256 | import stat |
277 | 257 | import urllib.error | |
278 | 258 | import urllib.request | |
279 | if sys.version_info[0] == 3: | ||
280 | import urllib.error | ||
281 | import urllib.request | ||
282 | else: | ||
283 | import imp | ||
284 | |||
285 | import urllib2 | ||
286 | |||
287 | urllib = imp.new_module("urllib") | ||
288 | urllib.request = urllib2 | ||
289 | urllib.error = urllib2 | ||
290 | 259 | ||
291 | 260 | ||
292 | repo_config_dir = os.getenv("REPO_CONFIG_DIR", os.path.expanduser("~")) | 261 | repo_config_dir = os.getenv("REPO_CONFIG_DIR", os.path.expanduser("~")) |