summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoranatoly techtonik <techtonik@gmail.com>2012-12-08 01:30:14 +0300
committeranatoly techtonik <techtonik@gmail.com>2012-12-08 01:30:14 +0300
commit0c9217a6328a5fa64d04a5df229adb76be27f736 (patch)
tree622397d373c16dedbe0bb5e98af5c2ec15405d57 /src
parenta5ff23c20f1360d7e66e12ca18bd7be93f580a31 (diff)
downloadscons-0c9217a6328a5fa64d04a5df229adb76be27f736.tar.gz
Removed some pre-Python 2.4 compatibility code
Diffstat (limited to 'src')
-rw-r--r--src/engine/SCons/Script/SConscript.py9
-rw-r--r--src/engine/SCons/compat/_scons_builtins.py43
-rw-r--r--src/script/scons.py18
3 files changed, 8 insertions, 62 deletions
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index aa555da7..bd515d25 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 3c8a0e59..6218cd15 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 cd8b4323..46e6d2b6 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]