summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Script
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2010-03-27 07:39:52 (GMT)
committerGreg Noel <GregNoel@tigris.org>2010-03-27 07:39:52 (GMT)
commit59ed0a109bf5add2efcef459080837b11066c6fb (patch)
treefff879b4f9676a72e16c0f7b4dd969f050038b4f /src/engine/SCons/Script
parent00a3188193ba1feef927cf18e7f5fc20ad71b848 (diff)
downloadSCons-59ed0a109bf5add2efcef459080837b11066c6fb.zip
SCons-59ed0a109bf5add2efcef459080837b11066c6fb.tar.gz
SCons-59ed0a109bf5add2efcef459080837b11066c6fb.tar.bz2
http://scons.tigris.org/issues/show_bug.cgi?id=2329
Applied a number of idiomatic changes. Uses of the 'sort()' method were converted into calls of 'sorted()' when possible and the sorted() expression was inserted into a subsequent statement whenever that made sense. The statement 'while 1:' was changed to 'while True:'. Names from the 'types' module (e.g., 'types.FooType') were converted to the equivalent build-in type (e.g., 'foo'). Comparisons between types were changed to use 'isinstance()'.
Diffstat (limited to 'src/engine/SCons/Script')
-rw-r--r--src/engine/SCons/Script/Main.py12
-rw-r--r--src/engine/SCons/Script/SConscript.py3
2 files changed, 4 insertions, 11 deletions
diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py
index 7173f1b..55ac598 100644
--- a/src/engine/SCons/Script/Main.py
+++ b/src/engine/SCons/Script/Main.py
@@ -316,11 +316,7 @@ class CleanTask(SCons.Taskmaster.AlwaysTask):
display("Removed " + pathstr)
elif os.path.isdir(path) and not os.path.islink(path):
# delete everything in the dir
- entries = os.listdir(path)
- # Sort for deterministic output (os.listdir() Can
- # return entries in a random order).
- entries.sort()
- for e in entries:
+ for e in sorted(os.listdir(path)):
p = os.path.join(path, e)
s = os.path.join(pathstr, e)
if os.path.isfile(p):
@@ -508,8 +504,6 @@ class CountStats(Stats):
for n, c in s:
stats_table[n][i] = c
i = i + 1
- keys = stats_table.keys()
- keys.sort()
self.outfp.write("Object counts:\n")
pre = [" "]
post = [" %s\n"]
@@ -520,7 +514,7 @@ class CountStats(Stats):
labels.append(("", "Class"))
self.outfp.write(fmt1 % tuple([x[0] for x in labels]))
self.outfp.write(fmt1 % tuple([x[1] for x in labels]))
- for k in keys:
+ for k in sorted(stats_table.keys()):
r = stats_table[k][:l] + [k]
self.outfp.write(fmt2 % tuple(r))
@@ -1228,7 +1222,7 @@ def _exec_main(parser, values):
options, args = parser.parse_args(all_args, values)
- if type(options.debug) == type([]) and "pdb" in options.debug:
+ if isinstance(options.debug, list) and "pdb" in options.debug:
import pdb
pdb.Pdb().runcall(_main, parser)
elif options.profile_file:
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index 1021921..c55d220 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -51,7 +51,6 @@ import os.path
import re
import sys
import traceback
-import types
import UserList
# The following variables used to live in this module. Some
@@ -629,7 +628,7 @@ def BuildDefaultGlobals():
import SCons.Script
d = SCons.Script.__dict__
def not_a_module(m, d=d, mtype=type(SCons.Script)):
- return type(d[m]) != mtype
+ return not isinstance(d[m], mtype)
for m in filter(not_a_module, dir(SCons.Script)):
GlobalDict[m] = d[m]