summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins001@gmail.com>2016-09-20 15:05:06 -0400
committerWilliam Blevins <wblevins001@gmail.com>2016-09-20 15:05:06 -0400
commita866042810446ca47cf7479f25a005f0550a163f (patch)
treea17ce5fe708b05dd585522c5d822a286ac8129d0
parentdd33f618a671f82ee15d427851dac074668b2713 (diff)
downloadscons-a866042810446ca47cf7479f25a005f0550a163f.tar.gz
Futurize stage 2 2to3 fixes only.
-rw-r--r--QMTest/TestSCons.py6
-rw-r--r--QMTest/scons_tdb.py2
-rw-r--r--bench/bench.py2
-rw-r--r--bin/SConsDoc.py2
-rw-r--r--bin/SConsExamples.py4
-rw-r--r--bin/caller-tree.py2
-rw-r--r--bin/memoicmp.py8
-rw-r--r--bin/objcounts.py4
-rw-r--r--bin/scons-diff.py2
-rw-r--r--bin/scons-proc.py2
-rw-r--r--src/engine/SCons/Action.py6
-rw-r--r--src/engine/SCons/ActionTests.py6
-rw-r--r--src/engine/SCons/Builder.py2
-rw-r--r--src/engine/SCons/BuilderTests.py4
-rw-r--r--src/engine/SCons/Debug.py4
-rw-r--r--src/engine/SCons/Defaults.py2
-rw-r--r--src/engine/SCons/Environment.py34
-rw-r--r--src/engine/SCons/EnvironmentTests.py2
-rw-r--r--src/engine/SCons/Node/Alias.py2
-rw-r--r--src/engine/SCons/Node/FS.py8
-rw-r--r--src/engine/SCons/Node/Python.py2
-rw-r--r--src/engine/SCons/Node/__init__.py16
-rw-r--r--src/engine/SCons/SConf.py4
-rw-r--r--src/engine/SCons/SConsign.py10
-rw-r--r--src/engine/SCons/Scanner/LaTeX.py4
-rw-r--r--src/engine/SCons/Script/Interactive.py4
-rw-r--r--src/engine/SCons/Script/Main.py2
-rw-r--r--src/engine/SCons/Script/SConsOptions.py2
-rw-r--r--src/engine/SCons/Script/SConscript.py2
-rw-r--r--src/engine/SCons/Taskmaster.py2
-rw-r--r--src/engine/SCons/Tool/MSCommon/common.py4
-rw-r--r--src/engine/SCons/Tool/MSCommon/vc.py2
-rw-r--r--src/engine/SCons/Tool/MSCommon/vs.py2
-rw-r--r--src/engine/SCons/Tool/aixlink.py2
-rw-r--r--src/engine/SCons/Tool/docbook/__init__.py2
-rw-r--r--src/engine/SCons/Tool/gnulink.py2
-rw-r--r--src/engine/SCons/Tool/install.py2
-rw-r--r--src/engine/SCons/Tool/intelc.py4
-rw-r--r--src/engine/SCons/Tool/msvs.py26
-rw-r--r--src/engine/SCons/Tool/msvsTests.py10
-rw-r--r--src/engine/SCons/Tool/packaging/__init__.py2
-rw-r--r--src/engine/SCons/Tool/packaging/ipk.py2
-rw-r--r--src/engine/SCons/Tool/packaging/msi.py6
-rw-r--r--src/engine/SCons/Tool/packaging/rpm.py4
-rw-r--r--src/engine/SCons/Tool/rpmutils.py2
-rw-r--r--src/engine/SCons/Util.py6
-rw-r--r--src/engine/SCons/Variables/EnumVariableTests.py4
-rw-r--r--src/engine/SCons/Variables/__init__.py2
-rw-r--r--src/engine/SCons/cpp.py8
-rw-r--r--src/script/scons-configure-cache.py276
-rw-r--r--src/script/scons-time.py4
-rw-r--r--src/test_files.py2
-rw-r--r--src/test_interrupts.py2
-rw-r--r--test/AS/nasm.py2
-rw-r--r--test/QT/QTFLAGS.py2
55 files changed, 266 insertions, 266 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index 98b2f00c..0d5dc901 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -1233,7 +1233,7 @@ class TimeSCons(TestSCons):
self.variables = kw.get('variables')
default_calibrate_variables = []
if self.variables is not None:
- for variable, value in self.variables.items():
+ for variable, value in list(self.variables.items()):
value = os.environ.get(variable, value)
try:
value = int(value)
@@ -1289,7 +1289,7 @@ class TimeSCons(TestSCons):
"""
if 'options' not in kw and self.variables:
options = []
- for variable, value in self.variables.items():
+ for variable, value in list(self.variables.items()):
options.append('%s=%s' % (variable, value))
kw['options'] = ' '.join(options)
if self.calibrate:
@@ -1315,7 +1315,7 @@ class TimeSCons(TestSCons):
self.elapsed_time(),
"seconds",
sort=0)
- for name, args in stats.items():
+ for name, args in list(stats.items()):
self.trace(name, trace, **args)
def uptime(self):
diff --git a/QMTest/scons_tdb.py b/QMTest/scons_tdb.py
index 76c7fe10..f5c0ae51 100644
--- a/QMTest/scons_tdb.py
+++ b/QMTest/scons_tdb.py
@@ -92,7 +92,7 @@ def get_explicit_arguments(e):
# Determine which subset of the 'arguments' have been set
# explicitly.
explicit_arguments = {}
- for name, field in arguments.items():
+ for name, field in list(arguments.items()):
# Do not record computed fields.
if field.IsComputed():
continue
diff --git a/bench/bench.py b/bench/bench.py
index f1d18c61..cfdac2d2 100644
--- a/bench/bench.py
+++ b/bench/bench.py
@@ -94,7 +94,7 @@ exec(open(args[0], 'rU').read())
try:
FunctionList
except NameError:
- function_names = sorted([x for x in locals().keys() if x[:4] == FunctionPrefix])
+ function_names = sorted([x for x in list(locals().keys()) if x[:4] == FunctionPrefix])
l = [locals()[f] for f in function_names]
FunctionList = [f for f in l if isinstance(f, types.FunctionType)]
diff --git a/bin/SConsDoc.py b/bin/SConsDoc.py
index d5666443..2fe4f73e 100644
--- a/bin/SConsDoc.py
+++ b/bin/SConsDoc.py
@@ -598,7 +598,7 @@ class SConsDocTree:
# Create xpath context
self.xpath_context = self.doc.xpathNewContext()
# Register namespaces
- for key, val in self.nsmap.items():
+ for key, val in list(self.nsmap.items()):
self.xpath_context.xpathRegisterNs(key, val)
def __del__(self):
diff --git a/bin/SConsExamples.py b/bin/SConsExamples.py
index dd9bfaf8..a86968d1 100644
--- a/bin/SConsExamples.py
+++ b/bin/SConsExamples.py
@@ -267,7 +267,7 @@ def ensureExampleOutputsExist(dpath):
os.mkdir(generated_examples)
examples = readAllExampleInfos(dpath)
- for key, value in examples.items():
+ for key, value in list(examples.items()):
# Process all scons_output tags
for o in value.outputs:
cpath = os.path.join(generated_examples,
@@ -305,7 +305,7 @@ def createAllExampleOutputs(dpath):
examples = readAllExampleInfos(dpath)
total = len(examples)
idx = 0
- for key, value in examples.items():
+ for key, value in list(examples.items()):
# Process all scons_output tags
print("%.2f%s (%d/%d) %s" % (float(idx + 1) * 100.0 / float(total),
perc, idx + 1, total, key))
diff --git a/bin/caller-tree.py b/bin/caller-tree.py
index 21cda4ba..18cd9e11 100644
--- a/bin/caller-tree.py
+++ b/bin/caller-tree.py
@@ -87,7 +87,7 @@ def print_entry(e, level, calls):
else:
print()
-for e in [ e for e in AllCalls.values() if not e.calls ]:
+for e in [ e for e in list(AllCalls.values()) if not e.calls ]:
print_entry(e, 0, '')
# Local Variables:
diff --git a/bin/memoicmp.py b/bin/memoicmp.py
index 7f0369ef..63f6538d 100644
--- a/bin/memoicmp.py
+++ b/bin/memoicmp.py
@@ -31,14 +31,14 @@ def memoize_cmp(filea, fileb):
ma_o = []
mb_o = []
mab = []
- for k in ma.keys():
- if k in mb.keys():
+ for k in list(ma.keys()):
+ if k in list(mb.keys()):
if k not in mab:
mab.append(k)
else:
ma_o.append(k)
- for k in mb.keys():
- if k in ma.keys():
+ for k in list(mb.keys()):
+ if k in list(ma.keys()):
if k not in mab:
mab.append(k)
else:
diff --git a/bin/objcounts.py b/bin/objcounts.py
index 2bd89236..8b550d1c 100644
--- a/bin/objcounts.py
+++ b/bin/objcounts.py
@@ -48,7 +48,7 @@ c1 = fetch_counts(sys.argv[1])
c2 = fetch_counts(sys.argv[2])
common = {}
-for k in c1.keys():
+for k in list(c1.keys()):
try:
common[k] = (c1[k], c2[k])
except KeyError:
@@ -59,7 +59,7 @@ for k in c1.keys():
if not '.' in k:
s = '.'+k
l = len(s)
- for k2 in c2.keys():
+ for k2 in list(c2.keys()):
if k2[-l:] == s:
common[k2] = (c1[k], c2[k2])
del c1[k]
diff --git a/bin/scons-diff.py b/bin/scons-diff.py
index 85975011..687e7fae 100644
--- a/bin/scons-diff.py
+++ b/bin/scons-diff.py
@@ -174,7 +174,7 @@ def diff_dir(left, right):
u[l] = 1
for r in rlist:
u[r] = 1
- for x in sorted([ x for x in u.keys() if x[-4:] != '.pyc' ]):
+ for x in sorted([ x for x in list(u.keys()) if x[-4:] != '.pyc' ]):
if x in llist:
if x in rlist:
do_diff(os.path.join(left, x),
diff --git a/bin/scons-proc.py b/bin/scons-proc.py
index e09c8538..0747b2cc 100644
--- a/bin/scons-proc.py
+++ b/bin/scons-proc.py
@@ -104,7 +104,7 @@ Link_Entities_Header = """\
class SCons_XML(object):
def __init__(self, entries, **kw):
self.values = entries
- for k, v in kw.items():
+ for k, v in list(kw.items()):
setattr(self, k, v)
def fopen(self, name):
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py
index 7e1f8f10..de9bf5ca 100644
--- a/src/engine/SCons/Action.py
+++ b/src/engine/SCons/Action.py
@@ -645,7 +645,7 @@ def _subproc(scons_env, cmd, error = 'ignore', **kw):
# Ensure that the ENV values are all strings:
new_env = {}
- for key, value in ENV.items():
+ for key, value in list(ENV.items()):
if is_List(value):
# If the value is a list, then we assume it is a path list,
# because that's a pretty common list-like value to stick
@@ -772,7 +772,7 @@ class CommandAction(_ActionAction):
ENV = get_default_ENV(env)
# Ensure that the ENV values are all strings:
- for key, value in ENV.items():
+ for key, value in list(ENV.items()):
if not is_String(value):
if is_List(value):
# If the value is a list, then we assume it is a
@@ -1206,7 +1206,7 @@ class ActionCaller(object):
def subst_kw(self, target, source, env):
kw = {}
- for key in self.kw.keys():
+ for key in list(self.kw.keys()):
kw[key] = self.subst(self.kw[key], target, source, env)
return kw
diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py
index 9007183d..b790ccc6 100644
--- a/src/engine/SCons/ActionTests.py
+++ b/src/engine/SCons/ActionTests.py
@@ -132,7 +132,7 @@ class Environment(object):
self.d['SPAWN'] = scons_env['SPAWN']
self.d['PSPAWN'] = scons_env['PSPAWN']
self.d['ESCAPE'] = scons_env['ESCAPE']
- for k, v in kw.items():
+ for k, v in list(kw.items()):
self.d[k] = v
# Just use the underlying scons_subst*() utility methods.
def subst(self, strSubst, raw=0, target=[], source=[], conv=None):
@@ -157,12 +157,12 @@ class Environment(object):
def Clone(self, **kw):
res = Environment()
res.d = SCons.Util.semi_deepcopy(self.d)
- for k, v in kw.items():
+ for k, v in list(kw.items()):
res.d[k] = v
return res
def sig_dict(self):
d = {}
- for k,v in self.items(): d[k] = v
+ for k,v in list(self.items()): d[k] = v
d['TARGETS'] = ['__t1__', '__t2__', '__t3__', '__t4__', '__t5__', '__t6__']
d['TARGET'] = d['TARGETS'][0]
d['SOURCES'] = ['__s1__', '__s2__', '__s3__', '__s4__', '__s5__', '__s6__']
diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py
index 50e85ec2..c7bce3a3 100644
--- a/src/engine/SCons/Builder.py
+++ b/src/engine/SCons/Builder.py
@@ -229,7 +229,7 @@ class OverrideWarner(collections.UserDict):
def warn(self):
if self.already_warned:
return
- for k in self.keys():
+ for k in list(self.keys()):
if k in misleading_keywords:
alt = misleading_keywords[k]
msg = "Did you mean to use `%s' instead of `%s'?" % (alt, k)
diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py
index 1e544a13..ca35abc0 100644
--- a/src/engine/SCons/BuilderTests.py
+++ b/src/engine/SCons/BuilderTests.py
@@ -79,7 +79,7 @@ class Environment(object):
self.d['SHELL'] = scons_env['SHELL']
self.d['SPAWN'] = scons_env['SPAWN']
self.d['ESCAPE'] = scons_env['ESCAPE']
- for k, v in kw.items():
+ for k, v in list(kw.items()):
self.d[k] = v
global env_arg2nodes_called
env_arg2nodes_called = None
@@ -140,7 +140,7 @@ class Environment(object):
return list(self.d.items())
def sig_dict(self):
d = {}
- for k,v in self.items(): d[k] = v
+ for k,v in list(self.items()): d[k] = v
d['TARGETS'] = ['__t1__', '__t2__', '__t3__', '__t4__', '__t5__', '__t6__']
d['TARGET'] = d['TARGETS'][0]
d['SOURCES'] = ['__s1__', '__s2__', '__s3__', '__s4__', '__s5__', '__s6__']
diff --git a/src/engine/SCons/Debug.py b/src/engine/SCons/Debug.py
index 9e520ff9..6ac5f27d 100644
--- a/src/engine/SCons/Debug.py
+++ b/src/engine/SCons/Debug.py
@@ -89,7 +89,7 @@ def dumpLoggedInstances(classes, file=sys.stdout):
obj = ref()
if obj is not None:
file.write(' %s:\n' % obj)
- for key, value in obj.__dict__.items():
+ for key, value in list(obj.__dict__.items()):
file.write(' %20s : %s\n' % (key, value))
@@ -163,7 +163,7 @@ def caller_trace(back=0):
# print a single caller and its callers, if any
def _dump_one_caller(key, file, level=0):
leader = ' '*level
- for v,c in sorted([(-v,c) for c,v in caller_dicts[key].items()]):
+ for v,c in sorted([(-v,c) for c,v in list(caller_dicts[key].items())]):
file.write("%s %6d %s:%d(%s)\n" % ((leader,-v) + func_shorten(c[-3:])))
if c in caller_dicts:
_dump_one_caller(c, file, level+1)
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py
index f1d5bcab..f0959829 100644
--- a/src/engine/SCons/Defaults.py
+++ b/src/engine/SCons/Defaults.py
@@ -459,7 +459,7 @@ def processDefines(defs):
else:
l.append(str(d[0]))
elif SCons.Util.is_Dict(d):
- for macro,value in d.items():
+ for macro,value in list(d.items()):
if value is not None:
l.append(str(macro) + '=' + str(value))
else:
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index d9790053..ed8ef786 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -152,7 +152,7 @@ def _set_BUILDERS(env, key, value):
except KeyError:
bd = BuilderDict(kwbd, env)
env._dict[key] = bd
- for k, v in value.items():
+ for k, v in list(value.items()):
if not SCons.Builder.is_a_Builder(v):
raise SCons.Errors.UserError('%s is not a Builder.' % repr(v))
bd.update(value)
@@ -324,7 +324,7 @@ class BuilderDict(UserDict):
delattr(self.env, item)
def update(self, dict):
- for i, v in dict.items():
+ for i, v in list(dict.items()):
self.__setitem__(i, v)
@@ -515,7 +515,7 @@ class SubstitutionEnvironment(object):
def subst_kw(self, kw, raw=0, target=None, source=None):
nkw = {}
- for k, v in kw.items():
+ for k, v in list(kw.items()):
k = self.subst(k, raw, target, source)
if SCons.Util.is_String(v):
v = self.subst(v, raw, target, source)
@@ -627,7 +627,7 @@ class SubstitutionEnvironment(object):
if not o: return self
overrides = {}
merges = None
- for key, value in o.items():
+ for key, value in list(o.items()):
if key == 'parse_flags':
merges = value
else:
@@ -815,7 +815,7 @@ class SubstitutionEnvironment(object):
if not unique:
self.Append(**args)
return self
- for key, value in args.items():
+ for key, value in list(args.items()):
if not value:
continue
try:
@@ -984,7 +984,7 @@ class Base(SubstitutionEnvironment):
# Now restore the passed-in and customized variables
# to the environment, since the values the user set explicitly
# should override any values set by the tools.
- for key, val in save.items():
+ for key, val in list(save.items()):
self._dict[key] = val
# Finally, apply any flags to be merged in
@@ -1185,7 +1185,7 @@ class Base(SubstitutionEnvironment):
if SCons.Util.is_List(val):
if key == 'CPPDEFINES':
tmp = []
- for (k, v) in orig.iteritems():
+ for (k, v) in orig.items():
if v is not None:
tmp.append((k, v))
else:
@@ -1247,7 +1247,7 @@ class Base(SubstitutionEnvironment):
values move to end.
"""
kw = copy_non_reserved_keywords(kw)
- for key, val in kw.items():
+ for key, val in list(kw.items()):
if SCons.Util.is_List(val):
val = _delete_duplicates(val, delete_existing)
if key not in self._dict or self._dict[key] in ('', None):
@@ -1273,7 +1273,7 @@ class Base(SubstitutionEnvironment):
# Construct a list of (key, value) tuples.
if SCons.Util.is_Dict(dk):
tmp = []
- for (k, v) in dk.iteritems():
+ for (k, v) in dk.items():
if v is not None:
tmp.append((k, v))
else:
@@ -1321,7 +1321,7 @@ class Base(SubstitutionEnvironment):
# Construct a list of (key, value) tuples.
if SCons.Util.is_Dict(val):
tmp = []
- for (k, v) in val.iteritems():
+ for (k, v) in val.items():
if v is not None:
tmp.append((k, v))
else:
@@ -1350,7 +1350,7 @@ class Base(SubstitutionEnvironment):
dk = [dk]
elif SCons.Util.is_Dict(dk):
tmp = []
- for (k, v) in dk.iteritems():
+ for (k, v) in dk.items():
if v is not None:
tmp.append((k, v))
else:
@@ -1363,7 +1363,7 @@ class Base(SubstitutionEnvironment):
val = [val]
elif SCons.Util.is_Dict(val):
tmp = []
- for i,j in val.items():
+ for i,j in list(val.items()):
if j is not None:
tmp.append((i,j))
else:
@@ -1405,7 +1405,7 @@ class Base(SubstitutionEnvironment):
# so the tools can use the new variables
kw = copy_non_reserved_keywords(kw)
new = {}
- for key, value in kw.items():
+ for key, value in list(kw.items()):
new[key] = SCons.Subst.scons_subst_once(value, self, key)
clone.Replace(**new)
@@ -1605,7 +1605,7 @@ class Base(SubstitutionEnvironment):
in an Environment.
"""
kw = copy_non_reserved_keywords(kw)
- for key, val in kw.items():
+ for key, val in list(kw.items()):
# It would be easier on the eyes to write this using
# "continue" statements whenever we finish processing an item,
# but Python 1.5.2 apparently doesn't let you use "continue"
@@ -1696,7 +1696,7 @@ class Base(SubstitutionEnvironment):
values move to front.
"""
kw = copy_non_reserved_keywords(kw)
- for key, val in kw.items():
+ for key, val in list(kw.items()):
if SCons.Util.is_List(val):
val = _delete_duplicates(val, not delete_existing)
if key not in self._dict or self._dict[key] in ('', None):
@@ -1833,7 +1833,7 @@ class Base(SubstitutionEnvironment):
uniq = {}
for executor in [n.get_executor() for n in nodes]:
uniq[executor] = 1
- for executor in uniq.keys():
+ for executor in list(uniq.keys()):
executor.add_pre_action(action)
return nodes
@@ -1843,7 +1843,7 @@ class Base(SubstitutionEnvironment):
uniq = {}
for executor in [n.get_executor() for n in nodes]:
uniq[executor] = 1
- for executor in uniq.keys():
+ for executor in list(uniq.keys()):
executor.add_post_action(action)
return nodes
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 4b57763e..e3259d42 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -164,7 +164,7 @@ class TestEnvironmentFixture(object):
default_keys = { 'CC' : 'cc',
'CCFLAGS' : '-DNDEBUG',
'ENV' : { 'TMP' : '/tmp' } }
- for key, value in default_keys.items():
+ for key, value in list(default_keys.items()):
if key not in kw:
kw[key] = value
if 'BUILDERS' not in kw:
diff --git a/src/engine/SCons/Node/Alias.py b/src/engine/SCons/Node/Alias.py
index a035816c..f229a9fa 100644
--- a/src/engine/SCons/Node/Alias.py
+++ b/src/engine/SCons/Node/Alias.py
@@ -89,7 +89,7 @@ class AliasNodeInfo(SCons.Node.NodeInfoBase):
"""
# TODO check or discard version
del state['_version_id']
- for key, value in state.items():
+ for key, value in list(state.items()):
if key not in ('__weakref__',):
setattr(self, key, value)
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index 71511b53..9b7e105d 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -1607,7 +1607,7 @@ class Dir(Base):
This clears any cached information that is invalidated by changing
the repository."""
- for node in self.entries.values():
+ for node in list(self.entries.values()):
if node != self.dir:
if node != self and isinstance(node, Dir):
node.__clearRepositoryCache(duplicate)
@@ -2179,7 +2179,7 @@ class Dir(Base):
for x in excludeList:
r = self.glob(x, ondisk, source, strings)
excludes.extend(r)
- result = filter(lambda x: not any(fnmatch.fnmatch(str(x), str(e)) for e in SCons.Util.flatten(excludes)), result)
+ result = [x for x in result if not any(fnmatch.fnmatch(str(x), str(e)) for e in SCons.Util.flatten(excludes))]
return sorted(result, key=lambda a: str(a))
def _glob1(self, pattern, ondisk=True, source=False, strings=False):
@@ -2203,7 +2203,7 @@ class Dir(Base):
# We use the .name attribute from the Node because the keys of
# the dir.entries dictionary are normalized (that is, all upper
# case) on case-insensitive systems like Windows.
- node_names = [ v.name for k, v in dir.entries.items()
+ node_names = [ v.name for k, v in list(dir.entries.items())
if k not in ('.', '..') ]
names.extend(node_names)
if not strings:
@@ -2481,7 +2481,7 @@ class FileNodeInfo(SCons.Node.NodeInfoBase):
"""
# TODO check or discard version
del state['_version_id']
- for key, value in state.items():
+ for key, value in list(state.items()):
if key not in ('__weakref__',):
setattr(self, key, value)
diff --git a/src/engine/SCons/Node/Python.py b/src/engine/SCons/Node/Python.py
index f151fc5e..92cc3204 100644
--- a/src/engine/SCons/Node/Python.py
+++ b/src/engine/SCons/Node/Python.py
@@ -67,7 +67,7 @@ class ValueNodeInfo(SCons.Node.NodeInfoBase):
"""
# TODO check or discard version
del state['_version_id']
- for key, value in state.items():
+ for key, value in list(state.items()):
if key not in ('__weakref__',):
setattr(self, key, value)
diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py
index 00ddf2f6..2bf38c2f 100644
--- a/src/engine/SCons/Node/__init__.py
+++ b/src/engine/SCons/Node/__init__.py
@@ -382,7 +382,7 @@ class NodeInfoBase(object):
try:
field_list = self.field_list
except AttributeError:
- field_list = getattr(self, '__dict__', {}).keys()
+ field_list = list(getattr(self, '__dict__', {}).keys())
for obj in type(self).mro():
for slot in getattr(obj, '__slots__', ()):
if slot not in ('__weakref__', '__dict__'):
@@ -427,7 +427,7 @@ class NodeInfoBase(object):
# TODO check or discard version
del state['_version_id']
- for key, value in state.items():
+ for key, value in list(state.items()):
if key not in ('__weakref__',):
setattr(self, key, value)
@@ -488,7 +488,7 @@ class BuildInfoBase(object):
"""
# TODO check or discard version
del state['_version_id']
- for key, value in state.items():
+ for key, value in list(state.items()):
if key not in ('__weakref__',):
setattr(self, key, value)
@@ -1338,7 +1338,7 @@ class Node(object, with_metaclass(NoSlotsPyPy)):
# dictionary patterns I found all ended up using "not in"
# internally anyway...)
if self.ignore_set:
- iter = chain.from_iterable(filter(None, [self.sources, self.depends, self.implicit]))
+ iter = chain.from_iterable([_f for _f in [self.sources, self.depends, self.implicit] if _f])
children = []
for i in iter:
@@ -1372,7 +1372,7 @@ class Node(object, with_metaclass(NoSlotsPyPy)):
# using dictionary keys, lose the order, and the only ordered
# dictionary patterns I found all ended up using "not in"
# internally anyway...)
- return list(chain.from_iterable(filter(None, [self.sources, self.depends, self.implicit])))
+ return list(chain.from_iterable([_f for _f in [self.sources, self.depends, self.implicit] if _f]))
def children(self, scan=1):
"""Return a list of the node's direct children, minus those
@@ -1396,7 +1396,7 @@ class Node(object, with_metaclass(NoSlotsPyPy)):
def Decider(self, function):
foundkey = None
- for k, v in _decider_map.iteritems():
+ for k, v in _decider_map.items():
if v == function:
foundkey = k
break
@@ -1609,8 +1609,8 @@ class Node(object, with_metaclass(NoSlotsPyPy)):
new_bkids = new.bsources + new.bdepends + new.bimplicit
new_bkidsigs = new.bsourcesigs + new.bdependsigs + new.bimplicitsigs
- osig = dict(zip(old_bkids, old_bkidsigs))
- nsig = dict(zip(new_bkids, new_bkidsigs))
+ osig = dict(list(zip(old_bkids, old_bkidsigs)))
+ nsig = dict(list(zip(new_bkids, new_bkidsigs)))
# The sources and dependencies we'll want to report are all stored
# as relative paths to this target's directory, but we want to
diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py
index d56b3338..c68d1c6f 100644
--- a/src/engine/SCons/SConf.py
+++ b/src/engine/SCons/SConf.py
@@ -132,7 +132,7 @@ def CreateConfigHBuilder(env):
_stringConfigH)
sconfigHBld = SCons.Builder.Builder(action=action)
env.Append( BUILDERS={'SConfigHBuilder':sconfigHBld} )
- for k in _ac_config_hs.keys():
+ for k in list(_ac_config_hs.keys()):
env.SConfigHBuilder(k, env.Value(_ac_config_hs[k]))
@@ -671,7 +671,7 @@ class SConfBase(object):
"""Adds all the tests given in the tests dictionary to this SConf
instance
"""
- for name in tests.keys():
+ for name in list(tests.keys()):
self.AddTest(name, tests[name])
def _createDir( self, node ):
diff --git a/src/engine/SCons/SConsign.py b/src/engine/SCons/SConsign.py
index 3a5e5c0b..75d2c419 100644
--- a/src/engine/SCons/SConsign.py
+++ b/src/engine/SCons/SConsign.py
@@ -155,7 +155,7 @@ class SConsignEntry(object):
return state
def __setstate__(self, state):
- for key, value in state.items():
+ for key, value in list(state.items()):
if key not in ('_version_id','__weakref__'):
setattr(self, key, value)
@@ -199,7 +199,7 @@ class Base(object):
pass
def merge(self):
- for key, node in self.to_be_merged.items():
+ for key, node in list(self.to_be_merged.items()):
entry = node.get_stored_info()
try:
ninfo = entry.ninfo
@@ -245,7 +245,7 @@ class DB(Base):
except Exception as e:
SCons.Warnings.warn(SCons.Warnings.CorruptSConsignWarning,
"Ignoring corrupt sconsign entry : %s (%s)\n"%(self.dir.get_tpath(), e))
- for key, entry in self.entries.items():
+ for key, entry in list(self.entries.items()):
entry.convert_from_sconsign(dir, key)
if mode == "r":
@@ -272,7 +272,7 @@ class DB(Base):
# the Repository; we only write to our own .sconsign file,
# not to .sconsign files in Repositories.
path = normcase(self.dir.get_internal_path())
- for key, entry in self.entries.items():
+ for key, entry in list(self.entries.items()):
entry.convert_to_sconsign()
db[path] = pickle.dumps(self.entries, PICKLE_PROTOCOL)
@@ -360,7 +360,7 @@ class DirFile(Dir):
fname = self.sconsign
except IOError:
return
- for key, entry in self.entries.items():
+ for key, entry in list(self.entries.items()):
entry.convert_to_sconsign()
pickle.dump(self.entries, file, PICKLE_PROTOCOL)
file.close()
diff --git a/src/engine/SCons/Scanner/LaTeX.py b/src/engine/SCons/Scanner/LaTeX.py
index 2cb1ed58..1e0fea15 100644
--- a/src/engine/SCons/Scanner/LaTeX.py
+++ b/src/engine/SCons/Scanner/LaTeX.py
@@ -200,14 +200,14 @@ class LaTeX(SCons.Scanner.Base):
"""
def __init__(self, dictionary):
self.dictionary = {}
- for k,n in dictionary.items():
+ for k,n in list(dictionary.items()):
self.dictionary[k] = ( SCons.Scanner.FindPathDirs(n),
FindENVPathDirs(n) )
def __call__(self, env, dir=None, target=None, source=None,
argument=None):
di = {}
- for k,(c,cENV) in self.dictionary.items():
+ for k,(c,cENV) in list(self.dictionary.items()):
di[k] = ( c(env, dir=None, target=None, source=None,
argument=None) ,
cENV(env, dir=None, target=None, source=None,
diff --git a/src/engine/SCons/Script/Interactive.py b/src/engine/SCons/Script/Interactive.py
index e7a0658f..3c3d23a0 100644
--- a/src/engine/SCons/Script/Interactive.py
+++ b/src/engine/SCons/Script/Interactive.py
@@ -121,7 +121,7 @@ class SConsInteractiveCmd(cmd.Cmd):
def __init__(self, **kw):
cmd.Cmd.__init__(self)
- for key, val in kw.items():
+ for key, val in list(kw.items()):
setattr(self, key, val)
if sys.platform == 'win32':
@@ -250,7 +250,7 @@ class SConsInteractiveCmd(cmd.Cmd):
while n:
n = walker.get_next()
- for node in seen_nodes.keys():
+ for node in list(seen_nodes.keys()):
# Call node.clear() to clear most of the state
node.clear()
# node.clear() doesn't reset node.state, so call
diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py
index c0b22a74..f8cb24c1 100644
--- a/src/engine/SCons/Script/Main.py
+++ b/src/engine/SCons/Script/Main.py
@@ -727,7 +727,7 @@ def _load_site_scons_dir(topdir, site_dir_name=None):
modname = os.path.basename(pathname)[:-len(sfx)]
site_m = {"__file__": pathname, "__name__": modname, "__doc__": None}
re_special = re.compile("__[^_]+__")
- for k in m.__dict__.keys():
+ for k in list(m.__dict__.keys()):
if not re_special.match(k):
site_m[k] = m.__dict__[k]
diff --git a/src/engine/SCons/Script/SConsOptions.py b/src/engine/SCons/Script/SConsOptions.py
index b2f2858f..501e4cef 100644
--- a/src/engine/SCons/Script/SConsOptions.py
+++ b/src/engine/SCons/Script/SConsOptions.py
@@ -638,7 +638,7 @@ def Parser(version):
for value in value__.split(','):
if value in debug_options:
parser.values.debug.append(value)
- elif value in deprecated_debug_options.keys():
+ elif value in list(deprecated_debug_options.keys()):
parser.values.debug.append(value)
try:
parser.values.delayed_warnings
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index 6480ace8..a7c8a370 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -526,7 +526,7 @@ class SConsEnvironment(SCons.Environment.Base):
return x
ls = list(map(subst_element, ls))
subst_kw = {}
- for key, val in kw.items():
+ for key, val in list(kw.items()):
if SCons.Util.is_String(val):
val = self.subst(val)
elif SCons.Util.is_List(val):
diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py
index 0f4fd219..461a5567 100644
--- a/src/engine/SCons/Taskmaster.py
+++ b/src/engine/SCons/Taskmaster.py
@@ -479,7 +479,7 @@ class Task(object):
if p.ref_count == 0:
self.tm.candidates.append(p)
- for p, subtract in parents.items():
+ for p, subtract in list(parents.items()):
p.ref_count = p.ref_count - subtract
if T: T.write(self.trace_message(u'Task.postprocess()',
p,
diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py
index bcfee2be..b14eba18 100644
--- a/src/engine/SCons/Tool/MSCommon/common.py
+++ b/src/engine/SCons/Tool/MSCommon/common.py
@@ -114,7 +114,7 @@ def normalize_env(env, keys, force=False):
Note: the environment is copied."""
normenv = {}
if env:
- for k in env.keys():
+ for k in list(env.keys()):
normenv[k] = copy.deepcopy(env[k])
for k in keys:
@@ -219,7 +219,7 @@ def parse_output(output, keep = ("INCLUDE", "LIB", "LIBPATH", "PATH")):
dkeep[key].append(p)
for line in output.splitlines():
- for k,v in rdk.items():
+ for k,v in list(rdk.items()):
m = v.match(line)
if m:
add_env(m, k)
diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py
index f96b8cad..baa4025e 100644
--- a/src/engine/SCons/Tool/MSCommon/vc.py
+++ b/src/engine/SCons/Tool/MSCommon/vc.py
@@ -514,7 +514,7 @@ def msvc_setup_env(env):
SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
return None
- for k, v in d.items():
+ for k, v in list(d.items()):
debug('vc.py:msvc_setup_env() env:%s -> %s'%(k,v))
env.PrependENVPath(k, v, delete_existing=True)
diff --git a/src/engine/SCons/Tool/MSCommon/vs.py b/src/engine/SCons/Tool/MSCommon/vs.py
index 31197ef0..4bda4060 100644
--- a/src/engine/SCons/Tool/MSCommon/vs.py
+++ b/src/engine/SCons/Tool/MSCommon/vs.py
@@ -545,7 +545,7 @@ def msvs_setup_env(env):
env['ENV'] = save_ENV
vars = parse_output(output, vars)
- for k, v in vars.items():
+ for k, v in list(vars.items()):
env.PrependENVPath(k, v, delete_existing=1)
def query_versions():
diff --git a/src/engine/SCons/Tool/aixlink.py b/src/engine/SCons/Tool/aixlink.py
index bfddf0ac..3117c551 100644
--- a/src/engine/SCons/Tool/aixlink.py
+++ b/src/engine/SCons/Tool/aixlink.py
@@ -65,7 +65,7 @@ def exists(env):
# TODO: sync with link.smart_link() to choose a linker
linkers = { 'CXX': ['aixc++'], 'CC': ['aixcc'] }
alltools = []
- for langvar, linktools in linkers.items():
+ for langvar, linktools in list(linkers.items()):
if langvar in env: # use CC over CXX when user specified CC but not CXX
return SCons.Tool.FindTool(linktools, env)
alltools.extend(linktools)
diff --git a/src/engine/SCons/Tool/docbook/__init__.py b/src/engine/SCons/Tool/docbook/__init__.py
index 2b22e17e..8a7b2e7a 100644
--- a/src/engine/SCons/Tool/docbook/__init__.py
+++ b/src/engine/SCons/Tool/docbook/__init__.py
@@ -461,7 +461,7 @@ def DocbookEpub(env, target, source=None, *args, **kw):
# Create xpath context
xpath_context = doc.xpathNewContext()
# Register namespaces
- for key, val in nsmap.iteritems():
+ for key, val in nsmap.items():
xpath_context.xpathRegisterNs(key, val)
if hasattr(opf, 'xpathEval') and xpath_context:
diff --git a/src/engine/SCons/Tool/gnulink.py b/src/engine/SCons/Tool/gnulink.py
index b1d50886..cf1ce859 100644
--- a/src/engine/SCons/Tool/gnulink.py
+++ b/src/engine/SCons/Tool/gnulink.py
@@ -67,7 +67,7 @@ def exists(env):
# TODO: sync with link.smart_link() to choose a linker
linkers = { 'CXX': ['g++'], 'CC': ['gcc'] }
alltools = []
- for langvar, linktools in linkers.items():
+ for langvar, linktools in list(linkers.items()):
if langvar in env: # use CC over CXX when user specified CC but not CXX
return SCons.Tool.FindTool(linktools, env)
alltools.extend(linktools)
diff --git a/src/engine/SCons/Tool/install.py b/src/engine/SCons/Tool/install.py
index e16bb5f0..ee157531 100644
--- a/src/engine/SCons/Tool/install.py
+++ b/src/engine/SCons/Tool/install.py
@@ -244,7 +244,7 @@ def add_versioned_targets_to_INSTALLED_FILES(target, source, env):
Verbose = False
_INSTALLED_FILES.extend(target)
if Verbose:
- print("add_versioned_targets_to_INSTALLED_FILES: target={:r}".format(map(str, target)))
+ print("add_versioned_targets_to_INSTALLED_FILES: target={:r}".format(list(map(str, target))))
symlinks = listShlibLinksToInstall(target[0], source, env)
if symlinks:
SCons.Tool.EmitLibSymlinks(env, symlinks, target[0])
diff --git a/src/engine/SCons/Tool/intelc.py b/src/engine/SCons/Tool/intelc.py
index 185db9e6..8ae02ef6 100644
--- a/src/engine/SCons/Tool/intelc.py
+++ b/src/engine/SCons/Tool/intelc.py
@@ -500,14 +500,14 @@ def generate(env, version=None, abi=None, topdir=None, verbose=0):
'LIB' : libdir,
'PATH' : bindir,
'LD_LIBRARY_PATH' : libdir}
- for p in paths.keys():
+ for p in list(paths.keys()):
env.PrependENVPath(p, os.path.join(topdir, paths[p]))
if is_mac:
paths={'INCLUDE' : 'include',
'LIB' : libdir,
'PATH' : bindir,
'LD_LIBRARY_PATH' : libdir}
- for p in paths.keys():
+ for p in list(paths.keys()):
env.PrependENVPath(p, os.path.join(topdir, paths[p]))
if is_windows:
# env key reg valname default subdir of top
diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py
index 8166d7dc..50f6b27b 100644
--- a/src/engine/SCons/Tool/msvs.py
+++ b/src/engine/SCons/Tool/msvs.py
@@ -210,11 +210,11 @@ class _UserGenerator(object):
dbg_settings and bool([ds for ds in dbg_settings if ds])
if self.createfile:
- dbg_settings = dict(zip(variants, dbg_settings))
- for var, src in dbg_settings.items():
+ dbg_settings = dict(list(zip(variants, dbg_settings)))
+ for var, src in list(dbg_settings.items()):
# Update only expected keys
trg = {}
- for key in [k for k in self.usrdebg.keys() if k in src]:
+ for key in [k for k in list(self.usrdebg.keys()) if k in src]:
trg[key] = str(src[key])
self.configs[var].debug = trg
@@ -301,7 +301,7 @@ class _GenerateV7User(_UserGenerator):
debug = self.configs[kind].debug
if debug:
debug_settings = '\n'.join(['\t\t\t\t%s="%s"' % (key, xmlify(value))
- for key, value in debug.items()
+ for key, value in list(debug.items())
if value is not None])
self.usrfile.write(self.usrconf % locals())
self.usrfile.write('\t</Configurations>\n</VisualStudioUserFile>')
@@ -363,7 +363,7 @@ class _GenerateV10User(_UserGenerator):
debug = self.configs[kind].debug
if debug:
debug_settings = '\n'.join(['\t\t<%s>%s</%s>' % (key, xmlify(value), key)
- for key, value in debug.items()
+ for key, value in list(debug.items())
if value is not None])
self.usrfile.write(self.usrconf % locals())
self.usrfile.write('</Project>')
@@ -533,7 +533,7 @@ class _DSPGenerator(object):
AddConfig(self, variants[i], buildtarget[i], outdir[i], runfile[i], cmdargs[i])
self.platforms = []
- for key in self.configs.keys():
+ for key in list(self.configs.keys()):
platform = self.configs[key].platform
if not platform in self.platforms:
self.platforms.append(platform)
@@ -656,7 +656,7 @@ class _GenerateV6DSP(_DSPGenerator):
'Resource Files': 'r|rc|ico|cur|bmp|dlg|rc2|rct|bin|cnt|rtf|gif|jpg|jpeg|jpe',
'Other Files': ''}
- for kind in sorted(categories.keys(), key=lambda a: a.lower()):
+ for kind in sorted(list(categories.keys()), key=lambda a: a.lower()):
if not self.sources[kind]:
continue # skip empty groups
@@ -922,7 +922,7 @@ class _GenerateV7DSP(_DSPGenerator, _GenerateV7User):
self.file.write(pdata + '-->\n')
def printSources(self, hierarchy, commonprefix):
- sorteditems = sorted(hierarchy.items(), key=lambda a: a[0].lower())
+ sorteditems = sorted(list(hierarchy.items()), key=lambda a: a[0].lower())
# First folders, then files
for key, value in sorteditems:
@@ -952,7 +952,7 @@ class _GenerateV7DSP(_DSPGenerator, _GenerateV7User):
self.file.write('\t<Files>\n')
- cats = sorted([k for k in categories.keys() if self.sources[k]],
+ cats = sorted([k for k in list(categories.keys()) if self.sources[k]],
key=lambda a: a.lower())
for kind in cats:
if len(cats) > 1:
@@ -1241,7 +1241,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
self.file.write(pdata + '-->\n')
def printFilters(self, hierarchy, name):
- sorteditems = sorted(hierarchy.items(), key = lambda a: a[0].lower())
+ sorteditems = sorted(list(hierarchy.items()), key = lambda a: a[0].lower())
for key, value in sorteditems:
if SCons.Util.is_Dict(value):
@@ -1258,7 +1258,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
'Resource Files': 'None',
'Other Files': 'None'}
- sorteditems = sorted(hierarchy.items(), key = lambda a: a[0].lower())
+ sorteditems = sorted(list(hierarchy.items()), key = lambda a: a[0].lower())
# First folders, then files
for key, value in sorteditems:
@@ -1284,7 +1284,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
'Resource Files': 'r;rc;ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe',
'Other Files': ''}
- cats = sorted([k for k in categories.keys() if self.sources[k]],
+ cats = sorted([k for k in list(categories.keys()) if self.sources[k]],
key = lambda a: a.lower())
# print vcxproj.filters file first
@@ -1442,7 +1442,7 @@ class _GenerateV7DSW(_DSWGenerator):
AddConfig(self, variant)
self.platforms = []
- for key in self.configs.keys():
+ for key in list(self.configs.keys()):
platform = self.configs[key].platform
if not platform in self.platforms:
self.platforms.append(platform)
diff --git a/src/engine/SCons/Tool/msvsTests.py b/src/engine/SCons/Tool/msvsTests.py
index 2bd640fb..bf82114f 100644
--- a/src/engine/SCons/Tool/msvsTests.py
+++ b/src/engine/SCons/Tool/msvsTests.py
@@ -624,7 +624,7 @@ class msvsTestCase(unittest.TestCase):
tests_cmdargs = [(None, dict.fromkeys(list_variant, '')),
('', dict.fromkeys(list_variant, '')),
(list_cmdargs[0], dict.fromkeys(list_variant, list_cmdargs[0])),
- (list_cmdargs, dict(zip(list_variant, list_cmdargs)))]
+ (list_cmdargs, dict(list(zip(list_variant, list_cmdargs))))]
# Run the test for each test case
for param_cmdargs, expected_cmdargs in tests_cmdargs:
@@ -651,8 +651,8 @@ class msvsTestCase(unittest.TestCase):
'cmdargs': expected_cmdargs[variant_platform]}
# Create parameter environment with final parameter dictionary
- param_dict = dict(zip(('variant', 'runfile', 'buildtarget', 'outdir'),
- [list(l) for l in zip(*param_configs)]))
+ param_dict = dict(list(zip(('variant', 'runfile', 'buildtarget', 'outdir'),
+ [list(l) for l in zip(*param_configs)])))
param_dict['cmdargs'] = param_cmdargs
# Hack to be able to run the test with a 'DummyEnv'
@@ -668,8 +668,8 @@ class msvsTestCase(unittest.TestCase):
genDSP = function_test(dspfile, source, env)
# Check expected result
- self.assertListEqual(genDSP.configs.keys(), expected_configs.keys())
- for key in genDSP.configs.keys():
+ self.assertListEqual(list(genDSP.configs.keys()), list(expected_configs.keys()))
+ for key in list(genDSP.configs.keys()):
self.assertDictEqual(genDSP.configs[key].__dict__, expected_configs[key])
class msvs6aTestCase(msvsTestCase):
diff --git a/src/engine/SCons/Tool/packaging/__init__.py b/src/engine/SCons/Tool/packaging/__init__.py
index 1a95abe3..17279383 100644
--- a/src/engine/SCons/Tool/packaging/__init__.py
+++ b/src/engine/SCons/Tool/packaging/__init__.py
@@ -72,7 +72,7 @@ def Tag(env, target, source, *more_tags, **kw_tags):
target=env.Flatten(target)
for t in target:
- for (k,v) in kw_tags.items():
+ for (k,v) in list(kw_tags.items()):
# all file tags have to start with PACKAGING_, so we can later
# differentiate between "normal" object attributes and the
# packaging attributes. As the user should not be bothered with
diff --git a/src/engine/SCons/Tool/packaging/ipk.py b/src/engine/SCons/Tool/packaging/ipk.py
index c6660331..ad4fe0f0 100644
--- a/src/engine/SCons/Tool/packaging/ipk.py
+++ b/src/engine/SCons/Tool/packaging/ipk.py
@@ -169,7 +169,7 @@ Description: $X_IPK_DESCRIPTION
#
# close all opened files
- for f in opened_files.values():
+ for f in list(opened_files.values()):
f.close()
# call a user specified function
diff --git a/src/engine/SCons/Tool/packaging/msi.py b/src/engine/SCons/Tool/packaging/msi.py
index c25f856b..73d3567e 100644
--- a/src/engine/SCons/Tool/packaging/msi.py
+++ b/src/engine/SCons/Tool/packaging/msi.py
@@ -172,7 +172,7 @@ def generate_guids(root):
# find all XMl nodes matching the key, retrieve their attribute, hash their
# subtree, convert hash to string and add as a attribute to the xml node.
- for (key,value) in needs_id.items():
+ for (key,value) in list(needs_id.items()):
node_list = root.getElementsByTagName(key)
attribute = value
for node in node_list:
@@ -335,7 +335,7 @@ def build_wxsfile_file_section(root, files, NAME, VERSION, VENDOR, filename_set,
}
# fill in the default tags given above.
- for k,v in [ (k, v) for (k,v) in h.items() if not hasattr(file, k) ]:
+ for k,v in [ (k, v) for (k,v) in list(h.items()) if not hasattr(file, k) ]:
setattr( file, k, v )
File = factory.createElement( 'File' )
@@ -382,7 +382,7 @@ def build_wxsfile_features_section(root, files, NAME, VERSION, SUMMARY, id_set):
Feature.attributes['Description'] = escape( SUMMARY )
Feature.attributes['Display'] = 'expand'
- for (feature, files) in create_feature_dict(files).items():
+ for (feature, files) in list(create_feature_dict(files).items()):
SubFeature = factory.createElement('Feature')
SubFeature.attributes['Level'] = '1'
diff --git a/src/engine/SCons/Tool/packaging/rpm.py b/src/engine/SCons/Tool/packaging/rpm.py
index a132555a..25b58758 100644
--- a/src/engine/SCons/Tool/packaging/rpm.py
+++ b/src/engine/SCons/Tool/packaging/rpm.py
@@ -270,7 +270,7 @@ def build_specfile_filesection(spec, files):
for file in files:
# build the tagset
tags = {}
- for k in supported_tags.keys():
+ for k in list(supported_tags.keys()):
try:
v = file.GetTag(k)
if v:
@@ -331,7 +331,7 @@ class SimpleTagCompiler(object):
international = [t for t in replacements if is_international(t[0])]
for key, replacement in international:
try:
- x = [t for t in values.items() if strip_country_code(t[0]) == key]
+ x = [t for t in list(values.items()) if strip_country_code(t[0]) == key]
int_values_for_key = [(get_country_code(t[0]),t[1]) for t in x]
for v in int_values_for_key:
str = str + replacement % v
diff --git a/src/engine/SCons/Tool/rpmutils.py b/src/engine/SCons/Tool/rpmutils.py
index 3eeed1df..d4db4178 100644
--- a/src/engine/SCons/Tool/rpmutils.py
+++ b/src/engine/SCons/Tool/rpmutils.py
@@ -520,7 +520,7 @@ def updateRpmDicts(rpmrc, pyfile):
if l.startswith('# Start of rpmrc dictionaries'):
pm = 1
# Write data sections to single dictionaries
- for key, entries in data.items():
+ for key, entries in list(data.items()):
out.write("%s = {\n" % key)
for arch in sorted(entries.keys()):
out.write(" '%s' : ['%s'],\n" % (arch, "','".join(entries[arch])))
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py
index 0be6196a..4f4ac2d0 100644
--- a/src/engine/SCons/Util.py
+++ b/src/engine/SCons/Util.py
@@ -477,7 +477,7 @@ _semi_deepcopy_dispatch = d = {}
def semi_deepcopy_dict(x, exclude = [] ):
copy = {}
- for key, val in x.items():
+ for key, val in list(x.items()):
# The regular Python copy.deepcopy() also deepcopies the key,
# as follows:
#
@@ -1037,7 +1037,7 @@ class OrderedDict(UserDict):
if key not in self._keys: self._keys.append(key)
def update(self, dict):
- for (key, val) in dict.items():
+ for (key, val) in list(dict.items()):
self.__setitem__(key, val)
def values(self):
@@ -1059,7 +1059,7 @@ class Selector(OrderedDict):
# Try to perform Environment substitution on the keys of
# the dictionary before giving up.
s_dict = {}
- for (k,v) in self.items():
+ for (k,v) in list(self.items()):
if k is not None:
s_k = env.subst(k)
if s_k in s_dict:
diff --git a/src/engine/SCons/Variables/EnumVariableTests.py b/src/engine/SCons/Variables/EnumVariableTests.py
index 931dfe2b..edc29738 100644
--- a/src/engine/SCons/Variables/EnumVariableTests.py
+++ b/src/engine/SCons/Variables/EnumVariableTests.py
@@ -124,7 +124,7 @@ class EnumVariableTestCase(unittest.TestCase):
'C' : ['C', 'three', 'three'],
}
- for k, l in table.items():
+ for k, l in list(table.items()):
x = o0.converter(k)
assert x == l[0], "o0 got %s, expected %s" % (x, l[0])
x = o1.converter(k)
@@ -188,7 +188,7 @@ class EnumVariableTestCase(unittest.TestCase):
'no_v' : [invalid, invalid, invalid],
}
- for v, l in table.items():
+ for v, l in list(table.items()):
l[0](o0, v)
l[1](o1, v)
l[2](o2, v)
diff --git a/src/engine/SCons/Variables/__init__.py b/src/engine/SCons/Variables/__init__.py
index b03e5b53..ce3541cd 100644
--- a/src/engine/SCons/Variables/__init__.py
+++ b/src/engine/SCons/Variables/__init__.py
@@ -185,7 +185,7 @@ class Variables(object):
if args is None:
args = self.args
- for arg, value in args.items():
+ for arg, value in list(args.items()):
added = False
for option in self.options:
if arg in list(option.aliases) + [ option.key ]:
diff --git a/src/engine/SCons/cpp.py b/src/engine/SCons/cpp.py
index 60cfcea5..18f154a0 100644
--- a/src/engine/SCons/cpp.py
+++ b/src/engine/SCons/cpp.py
@@ -72,7 +72,7 @@ cpp_lines_dict = {
# the corresponding compiled regular expression that fetches the arguments
# we care about.
Table = {}
-for op_list, expr in cpp_lines_dict.items():
+for op_list, expr in list(cpp_lines_dict.items()):
e = re.compile(expr)
for op in op_list:
Table[op] = e
@@ -87,7 +87,7 @@ del op_list
override = {
'if' : 'if(?!def)',
}
-l = [override.get(x, x) for x in Table.keys()]
+l = [override.get(x, x) for x in list(Table.keys())]
# Turn the list of expressions into one big honkin' regular expression
@@ -130,7 +130,7 @@ CPP_to_Python_Ops_Sub = lambda m: CPP_to_Python_Ops_Dict[m.group(0)]
# re module, as late as version 2.2.2, empirically matches the
# "!" in "!=" first, instead of finding the longest match.
# What's up with that?
-l = sorted(CPP_to_Python_Ops_Dict.keys(), key=lambda a: len(a), reverse=True)
+l = sorted(list(CPP_to_Python_Ops_Dict.keys()), key=lambda a: len(a), reverse=True)
# Turn the list of keys into one regular expression that will allow us
# to substitute all of the operators at once.
@@ -266,7 +266,7 @@ class PreProcessor(object):
d = {
'scons_current_file' : self.scons_current_file
}
- for op in Table.keys():
+ for op in list(Table.keys()):
d[op] = getattr(self, 'do_' + op)
self.default_table = d
diff --git a/src/script/scons-configure-cache.py b/src/script/scons-configure-cache.py
index c1b7d591..2648acda 100644
--- a/src/script/scons-configure-cache.py
+++ b/src/script/scons-configure-cache.py
@@ -1,139 +1,139 @@
-#! /usr/bin/env python
-#
-# SCons - a Software Constructor
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-__version__ = "__VERSION__"
-
-__build__ = "__BUILD__"
-
-__buildsys__ = "__BUILDSYS__"
-
-__date__ = "__DATE__"
-
-__developer__ = "__DEVELOPER__"
-
-import argparse
-import glob
-import json
-import os
-
-def rearrange_cache_entries(current_prefix_len, new_prefix_len):
- print 'Changing prefix length from', current_prefix_len, 'to', new_prefix_len
- dirs = set()
- old_dirs = set()
- for file in glob.iglob(os.path.join('*', '*')):
- name = os.path.basename(file)
- dir = name[:current_prefix_len].upper()
- if dir not in old_dirs:
- print 'Migrating', dir
- old_dirs.add(dir)
- dir = name[:new_prefix_len].upper()
- if dir not in dirs:
- os.mkdir(dir)
- dirs.add(dir)
- os.rename(file, os.path.join(dir, name))
-
- # Now delete the original directories
- for dir in old_dirs:
- os.rmdir(dir)
-
-# This dictionary should have one entry per entry in the cache config
-# Each entry should have the following:
-# implicit - (optional) This is to allow adding a new config entry and also
-# changing the behaviour of the system at the same time. This
-# indicates the value the config entry would have had if it had been
-# specified.
-# default - The value the config entry should have if it wasn't previously
-# specified
-# command-line - parameters to pass to ArgumentParser.add_argument
-# converter - (optional) Function to call if it's necessary to do some work
-# if this configuration entry changes
-config_entries = {
- 'prefix_len' : {
- 'implicit' : 1,
- 'default' : 2 ,
- 'command-line' : {
- 'help' : 'Length of cache file name used as subdirectory prefix',
- 'metavar' : '<number>',
- 'type' : int
- },
- 'converter' : rearrange_cache_entries
- }
-}
-parser = argparse.ArgumentParser(
- description = 'Modify the configuration of an scons cache directory',
- epilog = '''
- Unless you specify an option, it will not be changed (if it is
- already set in the cache config), or changed to an appropriate
- default (it it is not set).
- '''
- )
-
-parser.add_argument('cache-dir', help='Path to scons cache directory')
-for param in config_entries:
- parser.add_argument('--' + param.replace('_', '-'),
- **config_entries[param]['command-line'])
-parser.add_argument('--version', action='version', version='%(prog)s 1.0')
-
-# Get the command line as a dict without any of the unspecified entries.
-args = dict(filter(lambda x: x[1], vars(parser.parse_args()).items()))
-
-# It seems somewhat strange to me, but positional arguments don't get the -
-# in the name changed to _, whereas optional arguments do...
-os.chdir(args['cache-dir'])
-del args['cache-dir']
-
-if not os.path.exists('config'):
- # Validate the only files in the directory are directories 0-9, a-f
- expected = [ '{:X}'.format(x) for x in range(0, 16) ]
- if not set(os.listdir('.')).issubset(expected):
- raise RuntimeError("This doesn't look like a version 1 cache directory")
- config = dict()
-else:
- with open('config') as conf:
- config = json.load(conf)
-
-# Find any keys that aren't currently set but should be
-for key in config_entries:
- if key not in config:
- if 'implicit' in config_entries[key]:
- config[key] = config_entries[key]['implicit']
- else:
- config[key] = config_entries[key]['default']
- if key not in args:
- args[key] = config_entries[key]['default']
-
-#Now we go through each entry in args to see if it changes an existing config
-#setting.
-for key in args:
- if args[key] != config[key]:
- if 'converter' in config_entries[key]:
- config_entries[key]['converter'](config[key], args[key])
- config[key] = args[key]
-
-# and write the updated config file
-with open('config', 'w') as conf:
+#! /usr/bin/env python
+#
+# SCons - a Software Constructor
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+__version__ = "__VERSION__"
+
+__build__ = "__BUILD__"
+
+__buildsys__ = "__BUILDSYS__"
+
+__date__ = "__DATE__"
+
+__developer__ = "__DEVELOPER__"
+
+import argparse
+import glob
+import json
+import os
+
+def rearrange_cache_entries(current_prefix_len, new_prefix_len):
+ print 'Changing prefix length from', current_prefix_len, 'to', new_prefix_len
+ dirs = set()
+ old_dirs = set()
+ for file in glob.iglob(os.path.join('*', '*')):
+ name = os.path.basename(file)
+ dir = name[:current_prefix_len].upper()
+ if dir not in old_dirs:
+ print 'Migrating', dir
+ old_dirs.add(dir)
+ dir = name[:new_prefix_len].upper()
+ if dir not in dirs:
+ os.mkdir(dir)
+ dirs.add(dir)
+ os.rename(file, os.path.join(dir, name))
+
+ # Now delete the original directories
+ for dir in old_dirs:
+ os.rmdir(dir)
+
+# This dictionary should have one entry per entry in the cache config
+# Each entry should have the following:
+# implicit - (optional) This is to allow adding a new config entry and also
+# changing the behaviour of the system at the same time. This
+# indicates the value the config entry would have had if it had been
+# specified.
+# default - The value the config entry should have if it wasn't previously
+# specified
+# command-line - parameters to pass to ArgumentParser.add_argument
+# converter - (optional) Function to call if it's necessary to do some work
+# if this configuration entry changes
+config_entries = {
+ 'prefix_len' : {
+ 'implicit' : 1,
+ 'default' : 2 ,
+ 'command-line' : {
+ 'help' : 'Length of cache file name used as subdirectory prefix',
+ 'metavar' : '<number>',
+ 'type' : int
+ },
+ 'converter' : rearrange_cache_entries
+ }
+}
+parser = argparse.ArgumentParser(
+ description = 'Modify the configuration of an scons cache directory',
+ epilog = '''
+ Unless you specify an option, it will not be changed (if it is
+ already set in the cache config), or changed to an appropriate
+ default (it it is not set).
+ '''
+ )
+
+parser.add_argument('cache-dir', help='Path to scons cache directory')
+for param in config_entries:
+ parser.add_argument('--' + param.replace('_', '-'),
+ **config_entries[param]['command-line'])
+parser.add_argument('--version', action='version', version='%(prog)s 1.0')
+
+# Get the command line as a dict without any of the unspecified entries.
+args = dict([x for x in list(vars(parser.parse_args()).items()) if x[1]])
+
+# It seems somewhat strange to me, but positional arguments don't get the -
+# in the name changed to _, whereas optional arguments do...
+os.chdir(args['cache-dir'])
+del args['cache-dir']
+
+if not os.path.exists('config'):
+ # Validate the only files in the directory are directories 0-9, a-f
+ expected = [ '{:X}'.format(x) for x in range(0, 16) ]
+ if not set(os.listdir('.')).issubset(expected):
+ raise RuntimeError("This doesn't look like a version 1 cache directory")
+ config = dict()
+else:
+ with open('config') as conf:
+ config = json.load(conf)
+
+# Find any keys that aren't currently set but should be
+for key in config_entries:
+ if key not in config:
+ if 'implicit' in config_entries[key]:
+ config[key] = config_entries[key]['implicit']
+ else:
+ config[key] = config_entries[key]['default']
+ if key not in args:
+ args[key] = config_entries[key]['default']
+
+#Now we go through each entry in args to see if it changes an existing config
+#setting.
+for key in args:
+ if args[key] != config[key]:
+ if 'converter' in config_entries[key]:
+ config_entries[key]['converter'](config[key], args[key])
+ config[key] = args[key]
+
+# and write the updated config file
+with open('config', 'w') as conf:
json.dump(config, conf) \ No newline at end of file
diff --git a/src/script/scons-time.py b/src/script/scons-time.py
index ebdaf08c..edb9dad9 100644
--- a/src/script/scons-time.py
+++ b/src/script/scons-time.py
@@ -652,7 +652,7 @@ class SConsTimer(object):
sys.stderr.write('%s Cannot use the "func" subcommand.\n' % self.name_spaces)
sys.exit(1)
statistics = pstats.Stats(file).stats
- matches = [ e for e in statistics.items() if e[0][2] == function ]
+ matches = [ e for e in list(statistics.items()) if e[0][2] == function ]
r = matches[0]
return r[0][0], r[0][1], r[0][2], r[1][3]
@@ -1422,7 +1422,7 @@ class SConsTimer(object):
elif o in ('--title',):
self.title = a
elif o in ('--which',):
- if not a in self.time_strings.keys():
+ if not a in list(self.time_strings.keys()):
sys.stderr.write('%s: time: Unrecognized timer "%s".\n' % (self.name, a))
sys.stderr.write('%s Type "%s help time" for help.\n' % (self.name_spaces, self.name))
sys.exit(1)
diff --git a/src/test_files.py b/src/test_files.py
index 1eee11d9..ef276069 100644
--- a/src/test_files.py
+++ b/src/test_files.py
@@ -78,7 +78,7 @@ check = {
missing = []
no_result = []
-for directory, check_list in check.items():
+for directory, check_list in list(check.items()):
if os.path.exists(directory):
for c in check_list:
f = os.path.join(directory, c)
diff --git a/src/test_interrupts.py b/src/test_interrupts.py
index b81ef3f0..0fd8ba7f 100644
--- a/src/test_interrupts.py
+++ b/src/test_interrupts.py
@@ -104,7 +104,7 @@ for f in files:
indent_list.append( (line_num, match.group('try_or_except') ) )
try_except_lines[match.group('indent')] = indent_list
uncaught_this_file = []
- for indent in try_except_lines.keys():
+ for indent in list(try_except_lines.keys()):
exc_keyboardint_seen = 0
exc_all_seen = 0
for (l,statement) in try_except_lines[indent] + [(-1,indent + 'try')]:
diff --git a/test/AS/nasm.py b/test/AS/nasm.py
index be7db3ef..551a5ab5 100644
--- a/test/AS/nasm.py
+++ b/test/AS/nasm.py
@@ -69,7 +69,7 @@ else:
# anyway...).
nasm_format = 'elf'
format_map = {}
-for k, v in format_map.items():
+for k, v in list(format_map.items()):
if sys.platform.find(k) != -1:
nasm_format = v
break
diff --git a/test/QT/QTFLAGS.py b/test/QT/QTFLAGS.py
index f6aa00fd..e29ee803 100644
--- a/test/QT/QTFLAGS.py
+++ b/test/QT/QTFLAGS.py
@@ -147,7 +147,7 @@ test.must_exist(['work1', 'mmmmocFromH.cxx'],
['work1', 'mmmanother_ui_file.cxx'])
def _flagTest(test,fileToContentsStart):
- for f,c in fileToContentsStart.items():
+ for f,c in list(fileToContentsStart.items()):
if test.read(test.workpath('work1', f)).find(c) != 0:
return 1
return 0