summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2010-04-17 13:16:00 (GMT)
committerGreg Noel <GregNoel@tigris.org>2010-04-17 13:16:00 (GMT)
commite254cdf344ed0a466661b319dc019f2400ad12f3 (patch)
tree61e16d3edbaa1230dfa20699c4584c87d9b3f725 /src
parente4b439f4265613556de0124593ac86898d6f52c7 (diff)
downloadSCons-e254cdf344ed0a466661b319dc019f2400ad12f3.zip
SCons-e254cdf344ed0a466661b319dc019f2400ad12f3.tar.gz
SCons-e254cdf344ed0a466661b319dc019f2400ad12f3.tar.bz2
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')
-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
-rw-r--r--src/script/scons-time.py13
7 files changed, 25 insertions, 36 deletions
diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py
index 1d20a4f..6317a44 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 cc2e0a0..ece6d59 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 7a8f698..7b58594 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 83e11fc..92c1419 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 012d6c2..59be7af 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 bdcae63..97eb498 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:
diff --git a/src/script/scons-time.py b/src/script/scons-time.py
index d85dc8e..5f3d515 100644
--- a/src/script/scons-time.py
+++ b/src/script/scons-time.py
@@ -45,16 +45,11 @@ import tempfile
import time
try:
- False
+ True, False
except NameError:
- # Pre-2.2 Python has no False keyword.
- False = not 1
-
-try:
- True
-except NameError:
- # Pre-2.2 Python has no True keyword.
- True = not 0
+ # Pre-2.2 Python has no True or False keyword.
+ exec('True = not 0')
+ exec('False = not 1')
try:
sorted