From d32b2dcd1530a1cf30a4da380ec7388022b4a2bf Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Tue, 31 Oct 2023 16:49:26 -0400 Subject: [PATCH] repo: Remove unreachable code. Change-Id: I41371feb88c85e9da0656b9fab04057c22d1dcf4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/391514 Tested-by: Jason R. Coombs Reviewed-by: Mike Frysinger Commit-Queue: Jason R. Coombs --- repo | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/repo b/repo index 27381421..704bb2eb 100755 --- a/repo +++ b/repo @@ -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 +import urllib.error +import urllib.request repo_config_dir = os.getenv("REPO_CONFIG_DIR", os.path.expanduser("~"))