summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2010-04-19 01:26:35 (GMT)
committerGreg Noel <GregNoel@tigris.org>2010-04-19 01:26:35 (GMT)
commit2ef0a676a24eba8b205cdd69288729bd50168700 (patch)
tree633ec805de9e9f7c577a870e88bcbe38a72481d0
parentc0079cc5ace115fa5456fad81ec83242c5203926 (diff)
downloadSCons-2ef0a676a24eba8b205cdd69288729bd50168700.zip
SCons-2ef0a676a24eba8b205cdd69288729bd50168700.tar.gz
SCons-2ef0a676a24eba8b205cdd69288729bd50168700.tar.bz2
Index: test/Variables/help.py
=================================================================== --- test/Variables/help.py (revision 4792) +++ test/Variables/help.py (working copy) @@ -28,23 +28,15 @@ Test the Variables help messages. """ -import os.path +import os -try: - True, False -except NameError: - exec('True = (0 == 0)') - exec('False = (0 != 0)') +import TestSCons str_True = str(True) str_False = str(False) -import TestSCons - test = TestSCons.TestSCons() - - workpath = test.workpath() qtpath = os.path.join(workpath, 'qt') libpath = os.path.join(qtpath, 'lib') Index: test/Variables/PackageVariable.py =================================================================== --- test/Variables/PackageVariable.py (revision 4792) +++ test/Variables/PackageVariable.py (working copy) @@ -28,14 +28,8 @@ Test the PackageVariable canned Variable type. """ -import os.path +import os -try: - True, False -except NameError: - exec('True = (0 == 0)') - exec('False = (0 != 0)') - import TestSCons test = TestSCons.TestSCons() Index: test/Variables/BoolVariable.py =================================================================== --- test/Variables/BoolVariable.py (revision 4792) +++ test/Variables/BoolVariable.py (working copy) @@ -28,14 +28,8 @@ Test the BoolVariable canned Variable type. """ -import os.path +import os -try: - True, False -except NameError: - exec('True = (0 == 0)') - exec('False = (0 != 0)') - import TestSCons test = TestSCons.TestSCons() Index: test/Deprecated/Options/help.py =================================================================== --- test/Deprecated/Options/help.py (revision 4792) +++ test/Deprecated/Options/help.py (working copy) @@ -28,24 +28,16 @@ Test the Options help messages. """ -import os.path +import os import re -try: - True, False -except NameError: - exec('True = (0 == 0)') - exec('False = (0 != 0)') +import TestSCons str_True = str(True) str_False = str(False) -import TestSCons - test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - - workpath = test.workpath() qtpath = os.path.join(workpath, 'qt') libpath = os.path.join(qtpath, 'lib') Index: test/Deprecated/Options/PackageOption.py =================================================================== --- test/Deprecated/Options/PackageOption.py (revision 4792) +++ test/Deprecated/Options/PackageOption.py (working copy) @@ -28,14 +28,8 @@ Test the PackageOption canned Option type. """ -import os.path +import os -try: - True, False -except NameError: - exec('True = (0 == 0)') - exec('False = (0 != 0)') - import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) Index: test/Deprecated/Options/BoolOption.py =================================================================== --- test/Deprecated/Options/BoolOption.py (revision 4792) +++ test/Deprecated/Options/BoolOption.py (working copy) @@ -28,12 +28,6 @@ Test the BoolOption canned Option type. """ -try: - True, False -except NameError: - exec('True = (0 == 0)') - exec('False = (0 != 0)') - import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) Index: src/script/scons-time.py =================================================================== --- src/script/scons-time.py (revision 4792) +++ src/script/scons-time.py (working copy) @@ -45,13 +45,6 @@ import time try: - True, False -except NameError: - # Pre-2.2 Python has no True or False keyword. - exec('True = not 0') - exec('False = not 1') - -try: sorted except NameError: # Pre-2.4 Python has no sorted() function. Index: src/engine/SCons/compat/_scons_builtins.py =================================================================== --- src/engine/SCons/compat/_scons_builtins.py (revision 4792) +++ src/engine/SCons/compat/_scons_builtins.py (working copy) @@ -37,13 +37,8 @@ all() any() - bool() - dict() sorted() memoryview() - True - False - zip() Implementations of functions are *NOT* guaranteed to be fully compliant with these functions in later versions of Python. We are only concerned @@ -62,22 +57,6 @@ import builtins try: - False -except NameError: - # Pre-2.2 Python has no False keyword. - exec('builtins.False = not 1') - # Assign to False in this module namespace so it shows up in pydoc output. - #False = False - -try: - True -except NameError: - # Pre-2.2 Python has no True keyword. - exec('builtins.True = not 0') - # Assign to True in this module namespace so it shows up in pydoc output. - #True = True - -try: all except NameError: # Pre-2.5 Python has no all() function. @@ -108,42 +87,6 @@ any = any try: - bool -except NameError: - # Pre-2.2 Python has no bool() function. - def bool(value): - """Demote a value to 0 or 1, depending on its truth value. - - This is not to be confused with types.BooleanType, which is - way too hard to duplicate in early Python versions to be - worth the trouble. - """ - return not not value - builtins.bool = bool - bool = bool - -try: - dict -except NameError: - # Pre-2.2 Python has no dict() keyword. - def dict(seq=[], **kwargs): - """ - New dictionary initialization. - """ - d = {} - for k, v in seq: - d[k] = v - d.update(kwargs) - return d - builtins.dict = dict - -try: - file -except NameError: - # Pre-2.2 Python has no file() function. - builtins.file = open - -try: memoryview except NameError: # Pre-2.7 doesn't have the memoryview() built-in. @@ -185,27 +128,6 @@ return result builtins.sorted = sorted -# -try: - zip -except NameError: - # Pre-2.2 Python has no zip() function. - def zip(*lists): - """ - Emulates the behavior we need from the built-in zip() function - added in Python 2.2. - - Returns a list of tuples, where each tuple contains the i-th - element rom each of the argument sequences. The returned - list is truncated in length to the length of the shortest - argument sequence. - """ - result = [] - for i in range(min(list(map(len, lists)))): - result.append(tuple([l[i] for l in lists])) - return result - builtins.zip = zip - #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: Index: runtest.py =================================================================== --- runtest.py (revision 4792) +++ runtest.py (working copy) @@ -97,17 +97,6 @@ import time try: - x = True -except NameError: - True = not 0 - False = not 1 -else: - del x - -if not hasattr(os, 'WEXITSTATUS'): - os.WEXITSTATUS = lambda x: x - -try: sorted except NameError: # Pre-2.4 Python has no sorted() function. Index: QMTest/TestSCons.py =================================================================== --- QMTest/TestSCons.py (revision 4792) +++ QMTest/TestSCons.py (working copy) @@ -23,12 +23,6 @@ import sys import time -try: - True -except NameError: - exec('True = not 0') - exec('False = not 1') - from TestCommon import * from TestCommon import __all__
-rw-r--r--QMTest/TestSCons.py6
-rw-r--r--runtest.py11
-rw-r--r--src/engine/SCons/compat/_scons_builtins.py78
-rw-r--r--src/script/scons-time.py7
-rw-r--r--test/Deprecated/Options/BoolOption.py6
-rw-r--r--test/Deprecated/Options/PackageOption.py8
-rw-r--r--test/Deprecated/Options/help.py12
-rw-r--r--test/Variables/BoolVariable.py8
-rw-r--r--test/Variables/PackageVariable.py8
-rw-r--r--test/Variables/help.py12
10 files changed, 7 insertions, 149 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index 307c118..0317149 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -23,12 +23,6 @@ import shutil
import sys
import time
-try:
- True
-except NameError:
- exec('True = not 0')
- exec('False = not 1')
-
from TestCommon import *
from TestCommon import __all__
diff --git a/runtest.py b/runtest.py
index d00d56e..a5225f1 100644
--- a/runtest.py
+++ b/runtest.py
@@ -97,17 +97,6 @@ import sys
import time
try:
- x = True
-except NameError:
- True = not 0
- False = not 1
-else:
- del x
-
-if not hasattr(os, 'WEXITSTATUS'):
- os.WEXITSTATUS = lambda x: x
-
-try:
sorted
except NameError:
# Pre-2.4 Python has no sorted() function.
diff --git a/src/engine/SCons/compat/_scons_builtins.py b/src/engine/SCons/compat/_scons_builtins.py
index 59be7af..232dc59 100644
--- a/src/engine/SCons/compat/_scons_builtins.py
+++ b/src/engine/SCons/compat/_scons_builtins.py
@@ -37,13 +37,8 @@ This module checks for the following builtins names:
all()
any()
- bool()
- dict()
sorted()
memoryview()
- True
- False
- zip()
Implementations of functions are *NOT* guaranteed to be fully compliant
with these functions in later versions of Python. We are only concerned
@@ -62,22 +57,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import builtins
try:
- False
-except NameError:
- # Pre-2.2 Python has no False keyword.
- exec('builtins.False = not 1')
- # Assign to False in this module namespace so it shows up in pydoc output.
- #False = False
-
-try:
- True
-except NameError:
- # Pre-2.2 Python has no True keyword.
- exec('builtins.True = not 0')
- # Assign to True in this module namespace so it shows up in pydoc output.
- #True = True
-
-try:
all
except NameError:
# Pre-2.5 Python has no all() function.
@@ -108,42 +87,6 @@ except NameError:
any = any
try:
- bool
-except NameError:
- # Pre-2.2 Python has no bool() function.
- def bool(value):
- """Demote a value to 0 or 1, depending on its truth value.
-
- This is not to be confused with types.BooleanType, which is
- way too hard to duplicate in early Python versions to be
- worth the trouble.
- """
- return not not value
- builtins.bool = bool
- bool = bool
-
-try:
- dict
-except NameError:
- # Pre-2.2 Python has no dict() keyword.
- def dict(seq=[], **kwargs):
- """
- New dictionary initialization.
- """
- d = {}
- for k, v in seq:
- d[k] = v
- d.update(kwargs)
- return d
- builtins.dict = dict
-
-try:
- file
-except NameError:
- # Pre-2.2 Python has no file() function.
- builtins.file = open
-
-try:
memoryview
except NameError:
# Pre-2.7 doesn't have the memoryview() built-in.
@@ -185,27 +128,6 @@ except NameError:
return result
builtins.sorted = sorted
-#
-try:
- zip
-except NameError:
- # Pre-2.2 Python has no zip() function.
- def zip(*lists):
- """
- Emulates the behavior we need from the built-in zip() function
- added in Python 2.2.
-
- Returns a list of tuples, where each tuple contains the i-th
- element rom each of the argument sequences. The returned
- list is truncated in length to the length of the shortest
- argument sequence.
- """
- result = []
- for i in range(min(list(map(len, lists)))):
- result.append(tuple([l[i] for l in lists]))
- return result
- builtins.zip = zip
-
#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:
diff --git a/src/script/scons-time.py b/src/script/scons-time.py
index 6b52554..6586a0f 100644
--- a/src/script/scons-time.py
+++ b/src/script/scons-time.py
@@ -45,13 +45,6 @@ import tempfile
import time
try:
- True, False
-except NameError:
- # Pre-2.2 Python has no True or False keyword.
- exec('True = not 0')
- exec('False = not 1')
-
-try:
sorted
except NameError:
# Pre-2.4 Python has no sorted() function.
diff --git a/test/Deprecated/Options/BoolOption.py b/test/Deprecated/Options/BoolOption.py
index 0955d87..ac2ecdc 100644
--- a/test/Deprecated/Options/BoolOption.py
+++ b/test/Deprecated/Options/BoolOption.py
@@ -28,12 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test the BoolOption canned Option type.
"""
-try:
- True, False
-except NameError:
- exec('True = (0 == 0)')
- exec('False = (0 != 0)')
-
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
diff --git a/test/Deprecated/Options/PackageOption.py b/test/Deprecated/Options/PackageOption.py
index 3d15de0..424e5a7 100644
--- a/test/Deprecated/Options/PackageOption.py
+++ b/test/Deprecated/Options/PackageOption.py
@@ -28,13 +28,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test the PackageOption canned Option type.
"""
-import os.path
-
-try:
- True, False
-except NameError:
- exec('True = (0 == 0)')
- exec('False = (0 != 0)')
+import os
import TestSCons
diff --git a/test/Deprecated/Options/help.py b/test/Deprecated/Options/help.py
index 0b7226b..8c240e3 100644
--- a/test/Deprecated/Options/help.py
+++ b/test/Deprecated/Options/help.py
@@ -28,24 +28,16 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test the Options help messages.
"""
-import os.path
+import os
import re
-try:
- True, False
-except NameError:
- exec('True = (0 == 0)')
- exec('False = (0 != 0)')
+import TestSCons
str_True = str(True)
str_False = str(False)
-import TestSCons
-
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
-
-
workpath = test.workpath()
qtpath = os.path.join(workpath, 'qt')
libpath = os.path.join(qtpath, 'lib')
diff --git a/test/Variables/BoolVariable.py b/test/Variables/BoolVariable.py
index e3ebabd..365567e 100644
--- a/test/Variables/BoolVariable.py
+++ b/test/Variables/BoolVariable.py
@@ -28,13 +28,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test the BoolVariable canned Variable type.
"""
-import os.path
-
-try:
- True, False
-except NameError:
- exec('True = (0 == 0)')
- exec('False = (0 != 0)')
+import os
import TestSCons
diff --git a/test/Variables/PackageVariable.py b/test/Variables/PackageVariable.py
index 172d5e4..322bc9b 100644
--- a/test/Variables/PackageVariable.py
+++ b/test/Variables/PackageVariable.py
@@ -28,13 +28,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test the PackageVariable canned Variable type.
"""
-import os.path
-
-try:
- True, False
-except NameError:
- exec('True = (0 == 0)')
- exec('False = (0 != 0)')
+import os
import TestSCons
diff --git a/test/Variables/help.py b/test/Variables/help.py
index 6776327..f04f962 100644
--- a/test/Variables/help.py
+++ b/test/Variables/help.py
@@ -28,23 +28,15 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test the Variables help messages.
"""
-import os.path
+import os
-try:
- True, False
-except NameError:
- exec('True = (0 == 0)')
- exec('False = (0 != 0)')
+import TestSCons
str_True = str(True)
str_False = str(False)
-import TestSCons
-
test = TestSCons.TestSCons()
-
-
workpath = test.workpath()
qtpath = os.path.join(workpath, 'qt')
libpath = os.path.join(qtpath, 'lib')