summaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2010-04-17 13:16:00 +0000
committerGreg Noel <GregNoel@tigris.org>2010-04-17 13:16:00 +0000
commit65370312ea45bf85ebb5ddd64ecc97764c0cdad5 (patch)
tree61e16d3edbaa1230dfa20699c4584c87d9b3f725 /src/engine
parentea67705c79da513fe8e6c12b0ffb4b6c29e4fac8 (diff)
downloadscons-65370312ea45bf85ebb5ddd64ecc97764c0cdad5.tar.gz
http://scons.tigris.org/issues/show_bug.cgi?id=2345
Fix the 'assignment to True or False' and the '__getitem__ not supported for exception classes' deprecation warnings.
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/Builder.py2
-rw-r--r--src/engine/SCons/Defaults.py3
-rw-r--r--src/engine/SCons/Script/Main.py2
-rw-r--r--src/engine/SCons/WarningsTests.py2
-rw-r--r--src/engine/SCons/compat/_scons_builtins.py32
-rw-r--r--src/engine/SCons/compat/_scons_subprocess.py7
6 files changed, 21 insertions, 27 deletions
diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py
index 1d20a4fd..6317a44b 100644
--- a/src/engine/SCons/Builder.py
+++ b/src/engine/SCons/Builder.py
@@ -170,7 +170,7 @@ class DictCmdGenerator(SCons.Util.Selector):
try:
ret = SCons.Util.Selector.__call__(self, env, source, ext)
except KeyError, e:
- raise UserError("Ambiguous suffixes after environment substitution: %s == %s == %s" % (e[0], e[1], e[2]))
+ raise UserError("Ambiguous suffixes after environment substitution: %s == %s == %s" % (e.args[0], e.args[1], e.args[2]))
if ret is None:
raise UserError("While building `%s' from `%s': Don't know how to build from a source file with suffix `%s'. Expected a suffix in this list: %s." % \
(repr(list(map(str, target))), repr(list(map(str, source))), ext, repr(self.keys())))
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py
index cc2e0a00..ece6d590 100644
--- a/src/engine/SCons/Defaults.py
+++ b/src/engine/SCons/Defaults.py
@@ -223,7 +223,8 @@ def mkdir_func(dest):
os.makedirs(str(entry))
except os.error, e:
p = str(entry)
- if (e[0] == errno.EEXIST or (sys.platform=='win32' and e[0]==183)) \
+ if (e.args[0] == errno.EEXIST or
+ (sys.platform=='win32' and e.args[0]==183)) \
and os.path.isdir(str(entry)):
pass # not an error if already exists
else:
diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py
index 7a8f6980..7b585945 100644
--- a/src/engine/SCons/Script/Main.py
+++ b/src/engine/SCons/Script/Main.py
@@ -594,7 +594,7 @@ def _scons_internal_warning(e):
*current call stack* rather than sys.exc_info() to get our stack trace.
This is used by the warnings framework to print warnings."""
filename, lineno, routine, dummy = find_deepest_user_frame(traceback.extract_stack())
- sys.stderr.write("\nscons: warning: %s\n" % e[0])
+ sys.stderr.write("\nscons: warning: %s\n" % e.args[0])
sys.stderr.write('File "%s", line %d, in %s\n' % (filename, lineno, routine))
def _scons_internal_error():
diff --git a/src/engine/SCons/WarningsTests.py b/src/engine/SCons/WarningsTests.py
index 83e11fca..92c14199 100644
--- a/src/engine/SCons/WarningsTests.py
+++ b/src/engine/SCons/WarningsTests.py
@@ -29,7 +29,7 @@ import SCons.Warnings
class TestOutput:
def __call__(self, x):
- args = x[0]
+ args = x.args[0]
if len(args) == 1:
args = args[0]
self.out = str(args)
diff --git a/src/engine/SCons/compat/_scons_builtins.py b/src/engine/SCons/compat/_scons_builtins.py
index 012d6c2f..59be7af8 100644
--- a/src/engine/SCons/compat/_scons_builtins.py
+++ b/src/engine/SCons/compat/_scons_builtins.py
@@ -62,6 +62,22 @@ __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.
@@ -122,22 +138,6 @@ except NameError:
builtins.dict = dict
try:
- False
-except NameError:
- # Pre-2.2 Python has no False keyword.
- 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.
- builtins.True = not 0
- # Assign to True in this module namespace so it shows up in pydoc output.
- #True = True
-
-try:
file
except NameError:
# Pre-2.2 Python has no file() function.
diff --git a/src/engine/SCons/compat/_scons_subprocess.py b/src/engine/SCons/compat/_scons_subprocess.py
index bdcae637..97eb498c 100644
--- a/src/engine/SCons/compat/_scons_subprocess.py
+++ b/src/engine/SCons/compat/_scons_subprocess.py
@@ -433,13 +433,6 @@ except KeyboardInterrupt:
except:
MAXFD = 256
-# True/False does not exist on 2.2.0
-try:
- False
-except NameError:
- False = 0
- True = 1
-
try:
isinstance(1, int)
except TypeError: