summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2009-05-03 06:24:01 (GMT)
committerGreg Noel <GregNoel@tigris.org>2009-05-03 06:24:01 (GMT)
commitff74e256dccabac534aa952431063a23dfae9ac2 (patch)
treee50f626c5c42ff28c3cd21ab63f167627d08d7d4 /src
parent940ba4016c26bc49bdcb4e48bdd6b8b541e2aa1f (diff)
downloadSCons-ff74e256dccabac534aa952431063a23dfae9ac2.zip
SCons-ff74e256dccabac534aa952431063a23dfae9ac2.tar.gz
SCons-ff74e256dccabac534aa952431063a23dfae9ac2.tar.bz2
Issue 2401: Fix usage of comparison with None, patch from Jared Grubb
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt2
-rw-r--r--src/engine/SCons/ActionTests.py2
-rw-r--r--src/engine/SCons/BuilderTests.py8
-rw-r--r--src/engine/SCons/Defaults.py2
-rw-r--r--src/engine/SCons/Environment.py12
-rw-r--r--src/engine/SCons/EnvironmentTests.py66
-rw-r--r--src/engine/SCons/ErrorsTests.py10
-rw-r--r--src/engine/SCons/Node/AliasTests.py4
-rw-r--r--src/engine/SCons/Node/FSTests.py4
-rw-r--r--src/engine/SCons/Node/NodeTests.py18
-rw-r--r--src/engine/SCons/Node/Python.py2
-rw-r--r--src/engine/SCons/Node/__init__.py8
-rw-r--r--src/engine/SCons/Platform/posix.py2
-rw-r--r--src/engine/SCons/Platform/win32.py6
-rw-r--r--src/engine/SCons/SConf.py20
-rw-r--r--src/engine/SCons/SConfTests.py8
-rw-r--r--src/engine/SCons/Scanner/__init__.py2
-rw-r--r--src/engine/SCons/Script/Main.py4
-rw-r--r--src/engine/SCons/TaskmasterTests.py18
-rw-r--r--src/engine/SCons/Tool/JavaCommonTests.py12
-rw-r--r--src/engine/SCons/Tool/tex.py4
-rw-r--r--src/engine/SCons/Util.py2
-rw-r--r--src/engine/SCons/UtilTests.py4
-rw-r--r--src/engine/SCons/Variables/BoolVariableTests.py4
-rw-r--r--src/engine/SCons/Variables/EnumVariableTests.py4
-rw-r--r--src/engine/SCons/Variables/PackageVariableTests.py4
-rw-r--r--src/engine/SCons/Variables/PathVariableTests.py2
-rw-r--r--src/engine/SCons/Variables/VariablesTests.py12
-rw-r--r--src/script/scons-time.py2
-rw-r--r--src/test_interrupts.py4
30 files changed, 127 insertions, 125 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 846a57b..427d509 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -240,6 +240,8 @@ RELEASE 1.1.0.d20081207 - Sun, 07 Dec 2008 19:17:23 -0800
- Fix a typo in the documentation for $_CPPDEFFLAGS.
+ - Issue 2401: Fix usage of comparisons with None.
+
From Ludwig Hähne:
- Handle Java inner classes declared within a method.
diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py
index 3571980..b3f5221 100644
--- a/src/engine/SCons/ActionTests.py
+++ b/src/engine/SCons/ActionTests.py
@@ -262,7 +262,7 @@ def test_positional_args(pos_callback, cmd, **kw):
def none(a):
assert hasattr(a, 'strfunction')
- assert a.cmdstr == None, a.cmdstr
+ assert a.cmdstr is None, a.cmdstr
#FUTURE test_varlist(pos_callback, none, cmd, None, **kw)
apply(test_varlist, (pos_callback, none, cmd, None), kw)
diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py
index 8bb4169..b72b133 100644
--- a/src/engine/SCons/BuilderTests.py
+++ b/src/engine/SCons/BuilderTests.py
@@ -1108,7 +1108,7 @@ class BuilderTestCase(unittest.TestCase):
r = builder.get_prefix(env)
assert r == 'A_', r
r = builder.get_suffix(env)
- assert r == None, r
+ assert r is None, r
r = builder.get_src_suffix(env)
assert r == '', r
r = builder.src_suffixes(env)
@@ -1127,9 +1127,9 @@ class BuilderTestCase(unittest.TestCase):
r = builder.get_prefix(env)
assert r == 'A_', r
r = builder.get_suffix(env)
- assert r == None, r
+ assert r is None, r
r = builder.get_suffix(env, [MyNode('X.src_sfx1')])
- assert r == None, r
+ assert r is None, r
r = builder.get_src_suffix(env)
assert r == '.src_sfx1', r
r = builder.src_suffixes(env)
@@ -1145,7 +1145,7 @@ class BuilderTestCase(unittest.TestCase):
r = builder.get_prefix(env)
assert r == 'A_', r
r = builder.get_suffix(env)
- assert r == None, r
+ assert r is None, r
r = builder.get_src_suffix(env)
assert r == '.src_sfx1', r
r = builder.src_suffixes(env)
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py
index 7d44e38..a3acc52 100644
--- a/src/engine/SCons/Defaults.py
+++ b/src/engine/SCons/Defaults.py
@@ -273,7 +273,7 @@ def _concat(prefix, list, suffix, env, f=lambda x: x, target=None, source=None):
return list
l = f(SCons.PathList.PathList(list).subst_path(env, target, source))
- if not l is None:
+ if l is not None:
list = l
return _concat_ixes(prefix, list, suffix, env)
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index 37dd3b4..80d8516 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -245,9 +245,9 @@ class BuilderWrapper(MethodWrapper):
if source is _null:
source = target
target = None
- if not target is None and not SCons.Util.is_List(target):
+ if target is not None and not SCons.Util.is_List(target):
target = [target]
- if not source is None and not SCons.Util.is_List(source):
+ if source is not None and not SCons.Util.is_List(source):
source = [source]
return apply(MethodWrapper.__call__, (self, target, source) + args, kw)
@@ -457,9 +457,9 @@ class SubstitutionEnvironment:
n = None
for l in lookup_list:
n = l(v)
- if not n is None:
+ if n is not None:
break
- if not n is None:
+ if n is not None:
if SCons.Util.is_String(n):
# n = self.subst(n, raw=1, **kw)
kw['raw'] = 1
@@ -1822,7 +1822,7 @@ class Base(SubstitutionEnvironment):
def CacheDir(self, path):
import SCons.CacheDir
- if not path is None:
+ if path is not None:
path = self.subst(path)
self._CacheDir_path = path
@@ -2013,7 +2013,7 @@ class Base(SubstitutionEnvironment):
return apply(SCons.Scanner.Base, nargs, nkw)
def SConsignFile(self, name=".sconsign", dbm_module=None):
- if not name is None:
+ if name is not None:
name = self.subst(name)
if not os.path.isabs(name):
name = os.path.join(str(self.fs.SConstruct_dir), name)
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 27ede15..6d91620 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -956,20 +956,20 @@ class BaseTestCase(unittest.TestCase,TestEnvironmentFixture):
'builder2' : b2 })
called_it = {}
env.builder1('in1')
- assert called_it['target'] == None, called_it
+ assert called_it['target'] is None, called_it
assert called_it['source'] == ['in1'], called_it
called_it = {}
env.builder2(source = 'in2', xyzzy = 1)
- assert called_it['target'] == None, called_it
+ assert called_it['target'] is None, called_it
assert called_it['source'] == ['in2'], called_it
assert called_it['xyzzy'] == 1, called_it
called_it = {}
env.builder1(foo = 'bar')
assert called_it['foo'] == 'bar', called_it
- assert called_it['target'] == None, called_it
- assert called_it['source'] == None, called_it
+ assert called_it['target'] is None, called_it
+ assert called_it['source'] is None, called_it
def test_BuilderWrapper_attributes(self):
"""Test getting and setting of BuilderWrapper attributes
@@ -1976,12 +1976,12 @@ def generate(env):
assert paths[0] == env.FindIxes(paths, 'LIBPREFIX', 'LIBSUFFIX')
assert paths[1] == env.FindIxes(paths, 'SHLIBPREFIX', 'SHLIBSUFFIX')
- assert None == env.FindIxes(paths, 'PREFIX', 'POST')
+ assert None is env.FindIxes(paths, 'PREFIX', 'POST')
paths = ['libfoo.a', 'prefoopost']
assert paths[0] == env.FindIxes(paths, 'LIBPREFIX', 'LIBSUFFIX')
- assert None == env.FindIxes(paths, 'SHLIBPREFIX', 'SHLIBSUFFIX')
+ assert None is env.FindIxes(paths, 'SHLIBPREFIX', 'SHLIBSUFFIX')
assert paths[1] == env.FindIxes(paths, 'PREFIX', 'SUFFIX')
def test_ParseConfig(self):
@@ -2729,20 +2729,20 @@ def generate(env):
env = self.TestEnvironment(FOO = 'xyzzy')
b = env.Builder(action = 'foo')
- assert not b is None, b
+ assert b is not None, b
b = env.Builder(action = '$FOO')
- assert not b is None, b
+ assert b is not None, b
b = env.Builder(action = ['$FOO', 'foo'])
- assert not b is None, b
+ assert b is not None, b
def func(arg):
pass
b = env.Builder(action = func)
- assert not b is None, b
+ assert b is not None, b
b = env.Builder(generator = func)
- assert not b is None, b
+ assert b is not None, b
def test_CacheDir(self):
"""Test the CacheDir() method"""
@@ -2785,7 +2785,7 @@ def generate(env):
env = Environment()
t = env.Command(target='foo.out', source=['foo1.in', 'foo2.in'],
action='buildfoo $target $source')[0]
- assert not t.builder is None
+ assert t.builder is not None
assert t.builder.action.__class__.__name__ == 'CommandAction'
assert t.builder.action.cmd_list == 'buildfoo $target $source'
assert 'foo1.in' in map(lambda x: x.path, t.sources)
@@ -2802,7 +2802,7 @@ def generate(env):
return 0
t = env.Command(target='foo.out', source=['foo1.in','foo2.in'],
action=testFunc)[0]
- assert not t.builder is None
+ assert t.builder is not None
assert t.builder.action.__class__.__name__ == 'FunctionAction'
t.build()
assert 'foo1.in' in map(lambda x: x.path, t.sources)
@@ -2815,7 +2815,7 @@ def generate(env):
t = env.Command(target='baz.out', source='baz.in',
action='${TEST2(XYZ)}',
XYZ='magic word')[0]
- assert not t.builder is None
+ assert t.builder is not None
t.build()
assert x[0] == 'magic word', x
@@ -2846,11 +2846,11 @@ def generate(env):
pass
c = env.Configure()
- assert not c is None, c
+ assert c is not None, c
c.Finish()
c = env.Configure(custom_tests = {'foo' : func, '$FOO' : func})
- assert not c is None, c
+ assert c is not None, c
assert hasattr(c, 'foo')
assert hasattr(c, 'xyzzy')
c.Finish()
@@ -3139,17 +3139,17 @@ def generate(env):
env = self.TestEnvironment(FOO = scan)
s = env.Scanner('foo')
- assert not s is None, s
+ assert s is not None, s
s = env.Scanner(function = 'foo')
- assert not s is None, s
+ assert s is not None, s
if 0:
s = env.Scanner('$FOO')
- assert not s is None, s
+ assert s is not None, s
s = env.Scanner(function = '$FOO')
- assert not s is None, s
+ assert s is not None, s
def test_SConsignFile(self):
"""Test the SConsignFile() method"""
@@ -3175,19 +3175,19 @@ def generate(env):
env.SConsignFile('foo')
assert fnames[-1] == os.path.join(os.sep, 'dir', 'foo'), fnames
- assert dbms[-1] == None, dbms
+ assert dbms[-1] is None, dbms
env.SConsignFile('$FOO')
assert fnames[-1] == os.path.join(os.sep, 'dir', 'SConsign'), fnames
- assert dbms[-1] == None, dbms
+ assert dbms[-1] is None, dbms
env.SConsignFile('/$FOO')
assert fnames[-1] == os.sep + 'SConsign', fnames
- assert dbms[-1] == None, dbms
+ assert dbms[-1] is None, dbms
env.SConsignFile(os.sep + '$FOO')
assert fnames[-1] == os.sep + 'SConsign', fnames
- assert dbms[-1] == None, dbms
+ assert dbms[-1] is None, dbms
env.SConsignFile('$BAR', 'x')
assert fnames[-1] == os.path.join(os.sep, 'File'), fnames
@@ -3199,11 +3199,11 @@ def generate(env):
env.SConsignFile()
assert fnames[-1] == os.path.join(os.sep, 'dir', '.sconsign'), fnames
- assert dbms[-1] == None, dbms
+ assert dbms[-1] is None, dbms
env.SConsignFile(None)
- assert fnames[-1] == None, fnames
- assert dbms[-1] == None, dbms
+ assert fnames[-1] is None, fnames
+ assert dbms[-1] is None, dbms
finally:
SCons.SConsign.File = save_SConsign_File
@@ -3611,8 +3611,8 @@ class OverrideEnvironmentTestCase(unittest.TestCase,TestEnvironmentFixture):
assert env.get('YYY') == 'y', env.get('YYY')
assert env2.get('YYY') == 'y', env2.get('YYY')
assert env3.get('YYY') == 'y3', env3.get('YYY')
- assert env.get('ZZZ') == None, env.get('ZZZ')
- assert env2.get('ZZZ') == None, env2.get('ZZZ')
+ assert env.get('ZZZ') is None, env.get('ZZZ')
+ assert env2.get('ZZZ') is None, env2.get('ZZZ')
assert env3.get('ZZZ') == 'z3', env3.get('ZZZ')
def test_has_key(self):
@@ -3937,15 +3937,15 @@ class EnvironmentVariableTestCase(unittest.TestCase):
def test_is_valid_construction_var(self):
"""Testing is_valid_construction_var()"""
r = is_valid_construction_var("_a")
- assert not r is None, r
+ assert r is not None, r
r = is_valid_construction_var("z_")
- assert not r is None, r
+ assert r is not None, r
r = is_valid_construction_var("X_")
- assert not r is None, r
+ assert r is not None, r
r = is_valid_construction_var("2a")
assert r is None, r
r = is_valid_construction_var("a2_")
- assert not r is None, r
+ assert r is not None, r
r = is_valid_construction_var("/")
assert r is None, r
r = is_valid_construction_var("_/")
diff --git a/src/engine/SCons/ErrorsTests.py b/src/engine/SCons/ErrorsTests.py
index 40285e4..1eee6e1 100644
--- a/src/engine/SCons/ErrorsTests.py
+++ b/src/engine/SCons/ErrorsTests.py
@@ -68,13 +68,13 @@ class ErrorsTestCase(unittest.TestCase):
assert e.errstr == "Unknown error"
assert e.status == 2
assert e.exitstatus == 2
- assert e.filename == None
+ assert e.filename is None
assert e.exc_info == (None, None, None)
- assert e.node == None
- assert e.executor == None
- assert e.action == None
- assert e.command == None
+ assert e.node is None
+ assert e.executor is None
+ assert e.action is None
+ assert e.command is None
def test_InternalError(self):
"""Test the InternalError exception."""
diff --git a/src/engine/SCons/Node/AliasTests.py b/src/engine/SCons/Node/AliasTests.py
index 184e710..82322e3 100644
--- a/src/engine/SCons/Node/AliasTests.py
+++ b/src/engine/SCons/Node/AliasTests.py
@@ -35,7 +35,7 @@ class AliasTestCase(unittest.TestCase):
"""Test creating an Alias name space
"""
ans = SCons.Node.Alias.AliasNameSpace()
- assert not ans is None, ans
+ assert ans is not None, ans
def test_ANS_Alias(self):
"""Test the Alias() factory
@@ -82,7 +82,7 @@ class AliasTestCase(unittest.TestCase):
assert a is a1, a1
a = ans.lookup('a2')
- assert a == None, a
+ assert a is None, a
def test_Alias(self):
"""Test creating an Alias() object
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index 642d701..cb2bd68 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -611,7 +611,7 @@ class BaseTestCase(_tempdirTestCase):
e1 = fs.Entry('e1')
s = e1.stat()
- assert not s is None, s
+ assert s is not None, s
e2 = fs.Entry('e2')
s = e2.stat()
@@ -1386,7 +1386,7 @@ class FSTestCase(_tempdirTestCase):
f = fs.File('does_not_exist')
r = f.remove()
- assert r == None, r
+ assert r is None, r
test.write('exists', "exists\n")
f = fs.File('exists')
diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py
index 4612d3f..643e218 100644
--- a/src/engine/SCons/Node/NodeTests.py
+++ b/src/engine/SCons/Node/NodeTests.py
@@ -295,9 +295,9 @@ class NodeTestCase(unittest.TestCase):
# Make sure it doesn't blow up if no builder is set.
node = MyNode("www")
node.build()
- assert built_it == None
+ assert built_it is None
node.build(extra_kw_argument = 1)
- assert built_it == None
+ assert built_it is None
node = MyNode("xxx")
node.builder_set(Builder())
@@ -522,7 +522,7 @@ class NodeTestCase(unittest.TestCase):
n = SCons.Node.Node()
t, m = n.alter_targets()
assert t == [], t
- assert m == None, m
+ assert m is None, m
def test_is_up_to_date(self):
"""Test the default is_up_to_date() method
@@ -622,7 +622,7 @@ class NodeTestCase(unittest.TestCase):
node.fs = FS()
node.fs.Top = SCons.Node.Node()
result = node.explain()
- assert result == None, result
+ assert result is None, result
def get_null_info():
class Null_SConsignEntry:
@@ -1020,7 +1020,7 @@ class NodeTestCase(unittest.TestCase):
def test_scanner_key(self):
"""Test that a scanner_key() method exists"""
- assert SCons.Node.Node().scanner_key() == None
+ assert SCons.Node.Node().scanner_key() is None
def test_children(self):
"""Test fetching the non-ignored "children" of a Node.
@@ -1104,7 +1104,7 @@ class NodeTestCase(unittest.TestCase):
assert not nw.is_done()
assert nw.next().name == "n1"
assert nw.is_done()
- assert nw.next() == None
+ assert nw.next() is None
n2 = MyNode("n2")
n3 = MyNode("n3")
@@ -1118,7 +1118,7 @@ class NodeTestCase(unittest.TestCase):
n = nw.next()
assert n.name == "n1", n.name
n = nw.next()
- assert n == None, n
+ assert n is None, n
n4 = MyNode("n4")
n5 = MyNode("n5")
@@ -1138,7 +1138,7 @@ class NodeTestCase(unittest.TestCase):
assert nw.next().name == "n3"
assert nw.history.has_key(n1)
assert nw.next().name == "n1"
- assert nw.next() == None
+ assert nw.next() is None
n8 = MyNode("n8")
n8.add_dependency([n3])
@@ -1160,7 +1160,7 @@ class NodeTestCase(unittest.TestCase):
n = nw.next()
assert n.name == "n7", n.name
n = nw.next()
- assert nw.next() == None
+ assert nw.next() is None
def test_abspath(self):
"""Test the get_abspath() method."""
diff --git a/src/engine/SCons/Node/Python.py b/src/engine/SCons/Node/Python.py
index c443594..eba008b 100644
--- a/src/engine/SCons/Node/Python.py
+++ b/src/engine/SCons/Node/Python.py
@@ -53,7 +53,7 @@ class Value(SCons.Node.Node):
def __init__(self, value, built_value=None):
SCons.Node.Node.__init__(self)
self.value = value
- if not built_value is None:
+ if built_value is not None:
self.built_value = built_value
def str_for_display(self):
diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py
index ee9083c..c4f36cc 100644
--- a/src/engine/SCons/Node/__init__.py
+++ b/src/engine/SCons/Node/__init__.py
@@ -352,7 +352,7 @@ class Node:
if d.missing():
msg = "Explicit dependency `%s' not found, needed by target `%s'."
raise SCons.Errors.StopError, msg % (d, self)
- if not self.implicit is None:
+ if self.implicit is not None:
for i in self.implicit:
if i.missing():
msg = "Implicit dependency `%s' not found, needed by target `%s'."
@@ -474,7 +474,7 @@ class Node:
# There was no explicit builder for this Node, so initialize
# the self.builder attribute to None now.
b = self.builder = None
- return not b is None
+ return b is not None
def set_explicit(self, is_explicit):
self.is_explicit = is_explicit
@@ -602,7 +602,7 @@ class Node:
# Don't bother scanning non-derived files, because we don't
# care what their dependencies are.
# Don't scan again, if we already have scanned.
- if not self.implicit is None:
+ if self.implicit is not None:
return
self.implicit = []
self.implicit_set = set()
@@ -891,7 +891,7 @@ class Node:
def add_wkid(self, wkid):
"""Add a node to the list of kids waiting to be evaluated"""
- if self.wkids != None:
+ if self.wkids is not None:
self.wkids.append(wkid)
def _children_reset(self):
diff --git a/src/engine/SCons/Platform/posix.py b/src/engine/SCons/Platform/posix.py
index f18569f..d1102b3 100644
--- a/src/engine/SCons/Platform/posix.py
+++ b/src/engine/SCons/Platform/posix.py
@@ -116,7 +116,7 @@ def process_cmd_output(cmd_stdout, cmd_stderr, stdout, stderr):
str = cmd_stdout.read()
if len(str) == 0:
stdout_eof = 1
- elif stdout != None:
+ elif stdout is not None:
stdout.write(str)
if cmd_stderr in i:
str = cmd_stderr.read()
diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py
index fb23d5d..1dc7f3c 100644
--- a/src/engine/SCons/Platform/win32.py
+++ b/src/engine/SCons/Platform/win32.py
@@ -134,18 +134,18 @@ def piped_spawn(sh, escape, cmd, args, env, stdout, stderr):
ret = exitvalmap[e[0]]
except KeyError:
sys.stderr.write("scons: unknown OSError exception code %d - %s: %s\n" % (e[0], cmd, e[1]))
- if stderr != None:
+ if stderr is not None:
stderr.write("scons: %s: %s\n" % (cmd, e[1]))
# copy child output from tempfiles to our streams
# and do clean up stuff
- if stdout != None and stdoutRedirected == 0:
+ if stdout is not None and stdoutRedirected == 0:
try:
stdout.write(open( tmpFileStdout, "r" ).read())
os.remove( tmpFileStdout )
except (IOError, OSError):
pass
- if stderr != None and stderrRedirected == 0:
+ if stderr is not None and stderrRedirected == 0:
try:
stderr.write(open( tmpFileStderr, "r" ).read())
os.remove( tmpFileStderr )
diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py
index 5d671d2..8586402 100644
--- a/src/engine/SCons/SConf.py
+++ b/src/engine/SCons/SConf.py
@@ -398,11 +398,11 @@ class SConfBase:
if not SConfFS:
SConfFS = SCons.Node.FS.default_fs or \
SCons.Node.FS.FS(env.fs.pathTop)
- if not sconf_global is None:
+ if sconf_global is not None:
raise (SCons.Errors.UserError,
"Only one SConf object may be active at one time")
self.env = env
- if log_file != None:
+ if log_file is not None:
log_file = SConfFS.File(env.subst(log_file))
self.logfile = log_file
self.logstream = None
@@ -429,7 +429,7 @@ class SConfBase:
self.AddTests(default_tests)
self.AddTests(custom_tests)
self.confdir = SConfFS.Dir(env.subst(conf_dir))
- if not config_h is None:
+ if config_h is not None:
config_h = SConfFS.File(config_h)
self.config_h = config_h
self._startup()
@@ -471,7 +471,7 @@ class SConfBase:
Tries to build the given nodes immediately. Returns 1 on success,
0 on error.
"""
- if self.logstream != None:
+ if self.logstream is not None:
# override stdout / stderr to write in log file
oldStdout = sys.stdout
sys.stdout = self.logstream
@@ -510,7 +510,7 @@ class SConfBase:
SConfFS.set_max_drift(save_max_drift)
os.chdir(old_os_dir)
SConfFS.chdir(old_fs_dir, change_os_dir=0)
- if self.logstream != None:
+ if self.logstream is not None:
# restore stdout / stderr
sys.stdout = oldStdout
sys.stderr = oldStderr
@@ -559,7 +559,7 @@ class SConfBase:
self.env['SPAWN'] = self.pspawn_wrapper
sourcetext = self.env.Value(text)
- if text != None:
+ if text is not None:
textFile = self.confdir.File(f + extension)
textFileNode = self.env.SConfSourceBuilder(target=textFile,
source=sourcetext)
@@ -645,7 +645,7 @@ class SConfBase:
"Test called after sconf.Finish()")
context = CheckContext(self.sconf)
ret = apply(self.test, (context,) + args, kw)
- if not self.sconf.config_h is None:
+ if self.sconf.config_h is not None:
self.sconf.config_h_text = self.sconf.config_h_text + context.config_h
context.Result("error: no result")
return ret
@@ -685,7 +685,7 @@ class SConfBase:
self._createDir(self.confdir)
self.confdir.up().add_ignore( [self.confdir] )
- if self.logfile != None and not dryrun:
+ if self.logfile is not None and not dryrun:
# truncate logfile, if SConf.Configure is called for the first time
# in a build
if _ac_config_logs.has_key(self.logfile):
@@ -724,7 +724,7 @@ class SConfBase:
if not self.active:
raise SCons.Errors.UserError, "Finish may be called only once!"
- if self.logstream != None and not dryrun:
+ if self.logstream is not None and not dryrun:
self.logstream.write("\n")
self.logstream.close()
self.logstream = None
@@ -869,7 +869,7 @@ class CheckContext:
self.Log("scons: Configure: " + msg + "\n")
def Log(self, msg):
- if self.sconf.logstream != None:
+ if self.sconf.logstream is not None:
self.sconf.logstream.write(msg)
#### End of stuff used by Conftest.py.
diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py
index 2fa173d..5315ea3 100644
--- a/src/engine/SCons/SConfTests.py
+++ b/src/engine/SCons/SConfTests.py
@@ -141,9 +141,9 @@ class SConfTestCase(unittest.TestCase):
log = self.test.read( self.test.workpath('config.log') )
expr = re.compile( ".*failed in a previous run and all", re.DOTALL )
firstOcc = expr.match( log )
- assert firstOcc != None, log
+ assert firstOcc is not None, log
secondOcc = expr.match( log, firstOcc.end(0) )
- assert secondOcc == None, log
+ assert secondOcc is None, log
# 2.2 test the error caching mechanism (dependencies have changed)
self._resetSConfState()
@@ -285,9 +285,9 @@ int main() {
log = self.test.read( self.test.workpath('config.log') )
expr = re.compile( ".*failed in a previous run and all", re.DOTALL )
firstOcc = expr.match( log )
- assert firstOcc != None, log
+ assert firstOcc is not None, log
secondOcc = expr.match( log, firstOcc.end(0) )
- assert secondOcc == None, log
+ assert secondOcc is None, log
def test_TryAction(self):
diff --git a/src/engine/SCons/Scanner/__init__.py b/src/engine/SCons/Scanner/__init__.py
index c0d84b9..d0c7d3c 100644
--- a/src/engine/SCons/Scanner/__init__.py
+++ b/src/engine/SCons/Scanner/__init__.py
@@ -352,7 +352,7 @@ class Classic(Current):
def scan(self, node, path=()):
# cache the includes list in node so we only scan it once:
- if node.includes != None:
+ if node.includes is not None:
includes = node.includes
else:
includes = self.find_include_names (node)
diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py
index 44ca877..21fdc24 100644
--- a/src/engine/SCons/Script/Main.py
+++ b/src/engine/SCons/Script/Main.py
@@ -1101,14 +1101,14 @@ def _build_targets(fs, options, targets, target_top):
else:
node = None
# Why would ltop be None? Unfortunately this happens.
- if ltop == None: ltop = ''
+ if ltop is None: ltop = ''
# Curdir becomes important when SCons is called with -u, -C,
# or similar option that changes directory, and so the paths
# of targets given on the command line need to be adjusted.
curdir = os.path.join(os.getcwd(), str(ltop))
for lookup in SCons.Node.arg2nodes_lookups:
node = lookup(x, curdir=curdir)
- if node != None:
+ if node is not None:
break
if node is None:
node = fs.Entry(x, directory=ltop, create=1)
diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py
index 6c80230..7137967 100644
--- a/src/engine/SCons/TaskmasterTests.py
+++ b/src/engine/SCons/TaskmasterTests.py
@@ -207,7 +207,7 @@ class TaskmasterTestCase(unittest.TestCase):
t.prepare()
t.execute()
t = tm.next_task()
- assert t == None
+ assert t is None
n1 = Node("n1")
n2 = Node("n2")
@@ -236,7 +236,7 @@ class TaskmasterTestCase(unittest.TestCase):
t.executed()
t.postprocess()
- assert tm.next_task() == None
+ assert tm.next_task() is None
built_text = "up to date: "
top_node = n3
@@ -281,7 +281,7 @@ class TaskmasterTestCase(unittest.TestCase):
t.executed()
t.postprocess()
- assert tm.next_task() == None
+ assert tm.next_task() is None
n1 = Node("n1")
@@ -316,13 +316,13 @@ class TaskmasterTestCase(unittest.TestCase):
t5.executed()
t5.postprocess()
- assert tm.next_task() == None
+ assert tm.next_task() is None
n4 = Node("n4")
n4.set_state(SCons.Node.executed)
tm = SCons.Taskmaster.Taskmaster([n4])
- assert tm.next_task() == None
+ assert tm.next_task() is None
n1 = Node("n1")
n2 = Node("n2", [n1])
@@ -331,7 +331,7 @@ class TaskmasterTestCase(unittest.TestCase):
t.executed()
t.postprocess()
t = tm.next_task()
- assert tm.next_task() == None
+ assert tm.next_task() is None
n1 = Node("n1")
@@ -353,7 +353,7 @@ class TaskmasterTestCase(unittest.TestCase):
assert target == n3, target
t.executed()
t.postprocess()
- assert tm.next_task() == None
+ assert tm.next_task() is None
n1 = Node("n1")
n2 = Node("n2")
@@ -379,14 +379,14 @@ class TaskmasterTestCase(unittest.TestCase):
assert t.get_target() == n4
t.executed()
t.postprocess()
- assert tm.next_task() == None
+ assert tm.next_task() is None
assert scan_called == 4, scan_called
tm = SCons.Taskmaster.Taskmaster([n5])
t = tm.next_task()
assert t.get_target() == n5, t.get_target()
t.executed()
- assert tm.next_task() == None
+ assert tm.next_task() is None
assert scan_called == 5, scan_called
n1 = Node("n1")
diff --git a/src/engine/SCons/Tool/JavaCommonTests.py b/src/engine/SCons/Tool/JavaCommonTests.py
index f4a43ef..1d01087 100644
--- a/src/engine/SCons/Tool/JavaCommonTests.py
+++ b/src/engine/SCons/Tool/JavaCommonTests.py
@@ -75,7 +75,7 @@ public class BadDep {
}
"""
pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input)
- assert pkg_dir == None, pkg_dir
+ assert pkg_dir is None, pkg_dir
assert classes == ['BadDep'], classes
@@ -246,7 +246,7 @@ public class Test {
"""
pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input)
- assert pkg_dir == None, pkg_dir
+ assert pkg_dir is None, pkg_dir
assert classes == ['Test'], classes
@@ -265,7 +265,7 @@ public class MyTabs
"""
pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input)
- assert pkg_dir == None, pkg_dir
+ assert pkg_dir is None, pkg_dir
assert classes == ['MyTabs$MyInternal', 'MyTabs'], classes
@@ -302,7 +302,7 @@ public abstract class TestClass
"""
pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input)
- assert pkg_dir == None, pkg_dir
+ assert pkg_dir is None, pkg_dir
assert classes == ['TestClass$1', 'TestClass$2', 'TestClass'], classes
@@ -320,7 +320,7 @@ class Foo { }
"""
pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input)
- assert pkg_dir == None, pkg_dir
+ assert pkg_dir is None, pkg_dir
assert classes == ['TestSCons', 'Foo'], classes
@@ -354,7 +354,7 @@ public class A {
"""
pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input)
- assert pkg_dir == None, pkg_dir
+ assert pkg_dir is None, pkg_dir
assert classes == ['A$B', 'A'], classes
def test_anonymous_classes_with_parentheses(self):
diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py
index e0353b9..3473f8b 100644
--- a/src/engine/SCons/Tool/tex.py
+++ b/src/engine/SCons/Tool/tex.py
@@ -431,7 +431,7 @@ def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphi
print " scanning ",str(theFile)
for i in range(len(file_tests_search)):
- if file_tests[i][0] == None:
+ if file_tests[i][0] is None:
file_tests[i][0] = file_tests_search[i].search(content)
# recursively call this on each of the included files
@@ -444,7 +444,7 @@ def ScanFiles(theFile, target, paths, file_tests, file_tests_search, env, graphi
for src in inc_files:
srcNode = srcNode = FindFile(src,['.tex','.ltx','.latex'],paths,env,requireExt=False)
- if srcNode != None:
+ if srcNode is not None:
file_test = ScanFiles(srcNode, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir)
if Verbose:
print " done scanning ",str(theFile)
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py
index c77ee49..ac949a0 100644
--- a/src/engine/SCons/Util.py
+++ b/src/engine/SCons/Util.py
@@ -1127,7 +1127,7 @@ class Selector(OrderedDict):
# the dictionary before giving up.
s_dict = {}
for (k,v) in self.items():
- if not k is None:
+ if k is not None:
s_k = env.subst(k)
if s_dict.has_key(s_k):
# We only raise an error when variables point
diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py
index b76ba99..ee2c898 100644
--- a/src/engine/SCons/UtilTests.py
+++ b/src/engine/SCons/UtilTests.py
@@ -625,13 +625,13 @@ class UtilTestCase(unittest.TestCase):
s = Selector({'.d' : 'DDD', '.e' : 'EEE'})
ret = s(env, [])
- assert ret == None, ret
+ assert ret is None, ret
ret = s(env, [MyNode('foo.d')])
assert ret == 'DDD', ret
ret = s(env, [MyNode('bar.e')])
assert ret == 'EEE', ret
ret = s(env, [MyNode('bar.x')])
- assert ret == None, ret
+ assert ret is None, ret
s[None] = 'XXX'
ret = s(env, [MyNode('bar.x')])
assert ret == 'XXX', ret
diff --git a/src/engine/SCons/Variables/BoolVariableTests.py b/src/engine/SCons/Variables/BoolVariableTests.py
index 88f64ed..8ffb079 100644
--- a/src/engine/SCons/Variables/BoolVariableTests.py
+++ b/src/engine/SCons/Variables/BoolVariableTests.py
@@ -39,8 +39,8 @@ class BoolVariableTestCase(unittest.TestCase):
assert o.key == 'test', o.key
assert o.help == 'test option help (yes|no)', o.help
assert o.default == 0, o.default
- assert not o.validator is None, o.validator
- assert not o.converter is None, o.converter
+ assert o.validator is not None, o.validator
+ assert o.converter is not None, o.converter
def test_converter(self):
"""Test the BoolVariable converter"""
diff --git a/src/engine/SCons/Variables/EnumVariableTests.py b/src/engine/SCons/Variables/EnumVariableTests.py
index cc9289a..f4b600d 100644
--- a/src/engine/SCons/Variables/EnumVariableTests.py
+++ b/src/engine/SCons/Variables/EnumVariableTests.py
@@ -41,8 +41,8 @@ class EnumVariableTestCase(unittest.TestCase):
assert o.key == 'test', o.key
assert o.help == 'test option help (one|two|three)', o.help
assert o.default == 0, o.default
- assert not o.validator is None, o.validator
- assert not o.converter is None, o.converter
+ assert o.validator is not None, o.validator
+ assert o.converter is not None, o.converter
def test_converter(self):
"""Test the EnumVariable converter"""
diff --git a/src/engine/SCons/Variables/PackageVariableTests.py b/src/engine/SCons/Variables/PackageVariableTests.py
index 190357e..2a93348 100644
--- a/src/engine/SCons/Variables/PackageVariableTests.py
+++ b/src/engine/SCons/Variables/PackageVariableTests.py
@@ -41,8 +41,8 @@ class PackageVariableTestCase(unittest.TestCase):
assert o.key == 'test', o.key
assert o.help == 'test option help\n ( yes | no | /path/to/test )', repr(o.help)
assert o.default == '/default/path', o.default
- assert not o.validator is None, o.validator
- assert not o.converter is None, o.converter
+ assert o.validator is not None, o.validator
+ assert o.converter is not None, o.converter
def test_converter(self):
"""Test the PackageVariable converter"""
diff --git a/src/engine/SCons/Variables/PathVariableTests.py b/src/engine/SCons/Variables/PathVariableTests.py
index 4e6436e..1643252 100644
--- a/src/engine/SCons/Variables/PathVariableTests.py
+++ b/src/engine/SCons/Variables/PathVariableTests.py
@@ -44,7 +44,7 @@ class PathVariableTestCase(unittest.TestCase):
assert o.key == 'test', o.key
assert o.help == 'test option help ( /path/to/test )', repr(o.help)
assert o.default == '/default/path', o.default
- assert not o.validator is None, o.validator
+ assert o.validator is not None, o.validator
assert o.converter is None, o.converter
def test_PathExists(self):
diff --git a/src/engine/SCons/Variables/VariablesTests.py b/src/engine/SCons/Variables/VariablesTests.py
index 69ef9fe..493d69f 100644
--- a/src/engine/SCons/Variables/VariablesTests.py
+++ b/src/engine/SCons/Variables/VariablesTests.py
@@ -85,9 +85,9 @@ class VariablesTestCase(unittest.TestCase):
o = opts.options[0]
assert o.key == 'VAR'
assert o.help == ''
- assert o.default == None
- assert o.validator == None
- assert o.converter == None
+ assert o.default is None
+ assert o.validator is None
+ assert o.converter is None
o = opts.options[1]
assert o.key == 'ANSWER'
@@ -120,9 +120,9 @@ class VariablesTestCase(unittest.TestCase):
o = opts.options[0]
assert o.key == 'VAR2', o.key
assert o.help == '', o.help
- assert o.default == None, o.default
- assert o.validator == None, o.validator
- assert o.converter == None, o.converter
+ assert o.default is None, o.default
+ assert o.validator is None, o.validator
+ assert o.converter is None, o.converter
o = opts.options[1]
assert o.key == 'ANSWER2', o.key
diff --git a/src/script/scons-time.py b/src/script/scons-time.py
index 6e18892..eeddd87 100644
--- a/src/script/scons-time.py
+++ b/src/script/scons-time.py
@@ -715,7 +715,7 @@ class SConsTimer:
lines = open(file).readlines()
line = [ l for l in lines if l.endswith(object_string) ][0]
result = [ int(field) for field in line.split()[:4] ]
- if not index is None:
+ if index is not None:
result = result[index]
return result
diff --git a/src/test_interrupts.py b/src/test_interrupts.py
index 0876a01..0c7c4df 100644
--- a/src/test_interrupts.py
+++ b/src/test_interrupts.py
@@ -118,10 +118,10 @@ for f in files:
exc_all_seen = 0
line = l
#print " -> reset"
- elif not m1 is None:
+ elif m1 is not None:
exc_keyboardint_seen = 1
#print " -> keyboard -> ", m1.groups()
- elif not m2 is None:
+ elif m2 is not None:
exc_all_seen = 1
#print " -> all -> ", m2.groups()
else: