summaryrefslogtreecommitdiffstats
path: root/doc
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 /doc
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 'doc')
-rw-r--r--doc/user/environments.in10
-rw-r--r--doc/user/environments.xml10
-rw-r--r--doc/user/parseflags.in16
-rw-r--r--doc/user/parseflags.xml14
4 files changed, 13 insertions, 37 deletions
diff --git a/doc/user/environments.in b/doc/user/environments.in
index 0c04382..afd1463 100644
--- a/doc/user/environments.in
+++ b/doc/user/environments.in
@@ -672,11 +672,8 @@ environment, of directory names, suffixes, etc.
<sconstruct>
env = Environment()
- dict = env.Dictionary()
- keys = dict.keys()
- keys.sort()
- for key in keys:
- print "construction variable = '%s', value = '%s'" % (key, dict[key])
+ for item in sorted(env.Dictionary().items()):
+ print "construction variable = '%s', value = '%s'" % item
</sconstruct>
</section>
@@ -1559,8 +1556,7 @@ environment, of directory names, suffixes, etc.
if len(sys.argv) > 1:
keys = sys.argv[1:]
else:
- keys = os.environ.keys()
- keys.sort()
+ keys = sorted(os.environ.keys())
for key in keys:
print " " + key + "=" + os.environ[key]
</file>
diff --git a/doc/user/environments.xml b/doc/user/environments.xml
index 0746793..563d635 100644
--- a/doc/user/environments.xml
+++ b/doc/user/environments.xml
@@ -672,11 +672,8 @@ environment, of directory names, suffixes, etc.
<programlisting>
env = Environment()
- dict = env.Dictionary()
- keys = dict.keys()
- keys.sort()
- for key in keys:
- print "construction variable = '%s', value = '%s'" % (key, dict[key])
+ for item in sorted(env.Dictionary().items()):
+ print "construction variable = '%s', value = '%s'" % item
</programlisting>
</section>
@@ -1546,8 +1543,7 @@ environment, of directory names, suffixes, etc.
if len(sys.argv) > 1:
keys = sys.argv[1:]
else:
- keys = os.environ.keys()
- keys.sort()
+ keys = sorted(os.environ.keys())
for key in keys:
print " " + key + "=" + os.environ[key]
</file>
diff --git a/doc/user/parseflags.in b/doc/user/parseflags.in
index 733ee1d..a0ea290 100644
--- a/doc/user/parseflags.in
+++ b/doc/user/parseflags.in
@@ -61,9 +61,7 @@
<file name="SConstruct" printme="1">
env = Environment()
d = env.ParseFlags("-I/opt/include -L/opt/lib -lfoo")
- l = d.items()
- l.sort()
- for k,v in l:
+ for k,v in sorted(d.items()):
if v:
print k, v
env.MergeFlags(d)
@@ -102,9 +100,7 @@
<file name="SConstruct" printme="1">
env = Environment()
d = env.ParseFlags("-whatever")
- l = d.items()
- l.sort()
- for k,v in l:
+ for k,v in sorted(d.items()):
if v:
print k, v
env.MergeFlags(d)
@@ -130,9 +126,7 @@
<file name="SConstruct" printme="1">
env = Environment()
d = env.ParseFlags(["-I/opt/include", ["-L/opt/lib", "-lfoo"]])
- l = d.items()
- l.sort()
- for k,v in l:
+ for k,v in sorted(d.items()):
if v:
print k, v
env.MergeFlags(d)
@@ -159,9 +153,7 @@
<file name="SConstruct" printme="1">
env = Environment()
d = env.ParseFlags(["!echo -I/opt/include", "!echo -L/opt/lib", "-lfoo"])
- l = d.items()
- l.sort()
- for k,v in l:
+ for k,v in sorted(d.items()):
if v:
print k, v
env.MergeFlags(d)
diff --git a/doc/user/parseflags.xml b/doc/user/parseflags.xml
index 632077e..09533d2 100644
--- a/doc/user/parseflags.xml
+++ b/doc/user/parseflags.xml
@@ -60,9 +60,7 @@
<programlisting>
env = Environment()
d = env.ParseFlags("-I/opt/include -L/opt/lib -lfoo")
- l = d.items()
- l.sort()
- for k,v in l:
+ for k,v in sorted(d.items()):
if v:
print k, v
env.MergeFlags(d)
@@ -106,9 +104,7 @@
<programlisting>
env = Environment()
d = env.ParseFlags("-whatever")
- l = d.items()
- l.sort()
- for k,v in l:
+ for k,v in sorted(d.items()):
if v:
print k, v
env.MergeFlags(d)
@@ -132,9 +128,7 @@
<programlisting>
env = Environment()
d = env.ParseFlags(["-I/opt/include", ["-L/opt/lib", "-lfoo"]])
- l = d.items()
- l.sort()
- for k,v in l:
+ for k,v in sorted(d.items()):
if v:
print k, v
env.MergeFlags(d)
@@ -161,8 +155,6 @@
<programlisting>
env = Environment()
d = env.ParseFlags(["!echo -I/opt/include", "!echo -L/opt/lib", "-lfoo"])
- l = d.items()
- l.sort()
for k,v in l:
if v:
print k, v