@matheusbsbs / matheus-bagliano / commits / 0b4396f068
Fork 0

git-p4: make python2.7 the oldest supported version

Python2.6 and earlier have been end-of-life'd for many years now, and we actually already use 2.7-only features in the code. Make the version check reflect current realities. This also removes the need to explicitly define CalledProcessError if it's not available. Signed-off-by: Yang Zhao <yang.zhao@skyboxlabs.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Yang Zhao committed Dec 13, 2019 at 15:52 UTC 0b4396f0688f6c82ada83eab68b1c8dd3669d8bf
1 file changed +2 -18
git-p4.py
+2 -18
@@ -8,9 +8,8 @@
8 # License: MIT <http://www.opensource.org/licenses/mit-license.php>
9 #
10 import sys
11 -if sys.hexversion < 0x02040000:
12 - # The limiter is the subprocess module
13 - sys.stderr.write("git-p4: requires Python 2.4 or later.\n")
11 +if sys.version_info.major < 3 and sys.version_info.minor < 7:
12 + sys.stderr.write("git-p4: requires Python 2.7 or later.\n")
13 sys.exit(1)
14 import os
15 import optparse
@@ -43,21 +42,6 @@ else:
42 bytes = str
43 basestring = basestring
44
46 -try:
47 - from subprocess import CalledProcessError
48 -except ImportError:
49 - # from python2.7:subprocess.py
50 - # Exception classes used by this module.
51 - class CalledProcessError(Exception):
52 - """This exception is raised when a process run by check_call() returns
53 - a non-zero exit status. The exit status will be stored in the
54 - returncode attribute."""
55 - def __init__(self, returncode, cmd):
56 - self.returncode = returncode
57 - self.cmd = cmd
58 - def __str__(self):
59 - return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)
60 -
45 verbose = False
46
47 # Only labels/tags matching this will be imported/exported