summaryrefslogtreecommitdiffstats
path: root/src/script/scons-time.py
diff options
context:
space:
mode:
authorDirk Baechle <dl9obn@darc.de>2015-12-10 17:01:37 (GMT)
committerDirk Baechle <dl9obn@darc.de>2015-12-10 17:01:37 (GMT)
commite7de9d22c9503cf29e5d8b5e7813f060d59a00e5 (patch)
treed88708df964dc576ad2a85eedd9ef08cd29a0240 /src/script/scons-time.py
parent78fb1b6ef0e42954feb668efb84de59173221374 (diff)
downloadSCons-e7de9d22c9503cf29e5d8b5e7813f060d59a00e5.zip
SCons-e7de9d22c9503cf29e5d8b5e7813f060d59a00e5.tar.gz
SCons-e7de9d22c9503cf29e5d8b5e7813f060d59a00e5.tar.bz2
removed several pre-2.7 methods and imports, including some basic refactorings
Diffstat (limited to 'src/script/scons-time.py')
-rw-r--r--src/script/scons-time.py45
1 files changed, 1 insertions, 44 deletions
diff --git a/src/script/scons-time.py b/src/script/scons-time.py
index 3b215f9..02168d8 100644
--- a/src/script/scons-time.py
+++ b/src/script/scons-time.py
@@ -43,53 +43,10 @@ import sys
import tempfile
import time
-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
-
-if os.environ.get('SCONS_HORRIBLE_REGRESSION_TEST_HACK') is not None:
- # We can't apply the 'callable' fixer until the floor is 2.6, but the
- # '-3' option to Python 2.6 and 2.7 generates almost ten thousand
- # warnings. This hack allows us to run regression tests with the '-3'
- # option by replacing the callable() built-in function with a hack
- # that performs the same function but doesn't generate the warning.
- # Note that this hack is ONLY intended to be used for regression
- # testing, and should NEVER be used for real runs.
- from types import ClassType
- def callable(obj):
- if hasattr(obj, '__call__'): return True
- if isinstance(obj, (ClassType, type)): return True
- return False
-
def make_temp_file(**kw):
try:
result = tempfile.mktemp(**kw)
- try:
- result = os.path.realpath(result)
- except AttributeError:
- # Python 2.1 has no os.path.realpath() method.
- pass
+ result = os.path.realpath(result)
except TypeError:
try:
save_template = tempfile.template