diff options
author | anatoly techtonik <techtonik@gmail.com> | 2012-12-07 22:30:14 (GMT) |
---|---|---|
committer | anatoly techtonik <techtonik@gmail.com> | 2012-12-07 22:30:14 (GMT) |
commit | 0ee050e090f0acbb3909cf42822a8b86dbafc3c0 (patch) | |
tree | 622397d373c16dedbe0bb5e98af5c2ec15405d57 | |
parent | fe91cb8242f03fd95187b7c25bde6614d491bc5e (diff) | |
download | SCons-0ee050e090f0acbb3909cf42822a8b86dbafc3c0.zip SCons-0ee050e090f0acbb3909cf42822a8b86dbafc3c0.tar.gz SCons-0ee050e090f0acbb3909cf42822a8b86dbafc3c0.tar.bz2 |
Removed some pre-Python 2.4 compatibility code
-rw-r--r-- | QMTest/TestSCons_time.py | 20 | ||||
-rw-r--r-- | src/engine/SCons/Script/SConscript.py | 9 | ||||
-rw-r--r-- | src/engine/SCons/compat/_scons_builtins.py | 43 | ||||
-rw-r--r-- | src/script/scons.py | 18 |
4 files changed, 8 insertions, 82 deletions
diff --git a/QMTest/TestSCons_time.py b/QMTest/TestSCons_time.py index ce9e0df..4a759c0 100644 --- a/QMTest/TestSCons_time.py +++ b/QMTest/TestSCons_time.py @@ -175,26 +175,6 @@ class TestSCons_time(TestCommon): TestCommon.__init__(self, **kw) - # Now that the testing object has been set up, check if we should - # skip the test due to the Python version. We need to be able to - # import __future__ (which scons-time.py uses for nested scopes) - # and to handle list comprehensions (just because we're avoiding - # the old map() and filter() idioms). - - try: - import __future__ - except ImportError: - version = sys.version.split()[0] - msg = 'scons-time does not work on Python version %s\n' % version - self.skip_test(msg) - - try: - eval('[x for x in [1, 2]]') - except SyntaxError: - version = sys.version.split()[0] - msg = 'scons-time does not work on Python version %s\n' % version - self.skip_test(msg) - def archive_split(self, path): if path[-7:] == '.tar.gz': return path[:-7], path[-7:] diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py index aa555da..bd515d2 100644 --- a/src/engine/SCons/Script/SConscript.py +++ b/src/engine/SCons/Script/SConscript.py @@ -473,13 +473,8 @@ class SConsEnvironment(SCons.Environment.Base): def EnsurePythonVersion(self, major, minor): """Exit abnormally if the Python version is not late enough.""" - try: - v_major, v_minor, v_micro, release, serial = sys.version_info - python_ver = (v_major, v_minor) - except AttributeError: - python_ver = self._get_major_minor_revision(sys.version)[:2] - if python_ver < (major, minor): - v = sys.version.split(" ", 1)[0] + if sys.version_info < (major, minor): + v = sys.version.split()[0] print "Python %d.%d or greater required, but you have Python %s" %(major,minor,v) sys.exit(2) diff --git a/src/engine/SCons/compat/_scons_builtins.py b/src/engine/SCons/compat/_scons_builtins.py index 3c8a0e5..6218cd1 100644 --- a/src/engine/SCons/compat/_scons_builtins.py +++ b/src/engine/SCons/compat/_scons_builtins.py @@ -37,7 +37,6 @@ This module checks for the following builtins names: all() any() - sorted() memoryview() Implementations of functions are *NOT* guaranteed to be fully compliant @@ -101,48 +100,6 @@ except NameError: return self.obj[indx] builtins.memoryview = memoryview -try: - sorted -except NameError: - # Pre-2.4 Python has no sorted() function. - # - # The pre-2.4 Python list.sort() method does not support - # list.sort(key=) nor list.sort(reverse=) keyword arguments, so - # we must implement the functionality of those keyword arguments - # by hand instead of passing them to list.sort(). - def sorted(iterable, cmp=None, key=None, reverse=False): - if key is not None: - result = [(key(x), x) for x in iterable] - else: - result = iterable[:] - if cmp is None: - # Pre-2.3 Python does not support list.sort(None). - result.sort() - else: - result.sort(cmp) - if key is not None: - result = [t1 for t0,t1 in result] - if reverse: - result.reverse() - return result - builtins.sorted = sorted - -#if sys.version_info[:3] in ((2, 2, 0), (2, 2, 1)): -# def lstrip(s, c=string.whitespace): -# while s and s[0] in c: -# s = s[1:] -# return s -# def rstrip(s, c=string.whitespace): -# while s and s[-1] in c: -# s = s[:-1] -# return s -# def strip(s, c=string.whitespace, l=lstrip, r=rstrip): -# return l(r(s, c), c) -# -# object.__setattr__(str, 'lstrip', lstrip) -# object.__setattr__(str, 'rstrip', rstrip) -# object.__setattr__(str, 'strip', strip) - # Local Variables: # tab-width:4 # indent-tabs-mode:nil diff --git a/src/script/scons.py b/src/script/scons.py index cd8b432..46e6d2b 100644 --- a/src/script/scons.py +++ b/src/script/scons.py @@ -55,18 +55,12 @@ import sys # engine modules if they're in either directory. -# Check to see if the python version is > 3.0 which is currently unsupported -# If so exit with error message -try: - if sys.version_info >= (3,0,0): - msg = "scons: *** SCons version %s does not run under Python version %s.\n\ -Python 3.0 and later are not yet supported.\n" - sys.stderr.write(msg % (__version__, sys.version.split()[0])) - sys.exit(1) -except AttributeError: - # Pre-1.6 Python has no sys.version_info - # No need to check version as we then know the version is < 3.0.0 and supported - pass +if sys.version_info >= (3,0,0): + msg = "scons: *** SCons version %s does not run under Python version %s.\n\ +Python 3 is not yet supported.\n" + sys.stderr.write(msg % (__version__, sys.version.split()[0])) + sys.exit(1) + script_dir = sys.path[0] |