Skip to content

Commit 0b4396f

Browse files
yangskyboxlabsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 559c6fc commit 0b4396f

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

git-p4.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
# License: MIT <http://www.opensource.org/licenses/mit-license.php>
99
#
1010
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")
1413
sys.exit(1)
1514
import os
1615
import optparse
@@ -43,21 +42,6 @@
4342
bytes = str
4443
basestring = basestring
4544

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-
6145
verbose = False
6246

6347
# Only labels/tags matching this will be imported/exported

0 commit comments

Comments
 (0)