summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorStefan Zimmermann <zimmermann.code@gmail.com>2014-03-31 15:13:02 +0000
committerStefan Zimmermann <zimmermann.code@gmail.com>2014-03-31 15:13:02 +0000
commit15ad84e7cd33f33d287c63d6e00a221d859cce3b (patch)
tree4464eb544fe0cc698ea4d1c5789e19770b83cd6f /bin
parent9d3a9c2cc0187294500ea8018a7ffcc1c7b67037 (diff)
downloadscons-15ad84e7cd33f33d287c63d6e00a221d859cce3b.tar.gz
Made former 2to3 changes Python 2.7 compatible (or removed unneeded changes).
Diffstat (limited to 'bin')
-rw-r--r--bin/Command.py1
-rw-r--r--bin/SConsDoc.py9
-rw-r--r--bin/calibrate.py2
-rw-r--r--bin/caller-tree.py3
-rw-r--r--bin/docs-create-example-outputs.py1
-rw-r--r--bin/docs-update-generated.py1
-rw-r--r--bin/docs-validate.py1
-rw-r--r--bin/install_python.py1
-rw-r--r--bin/install_scons.py8
-rw-r--r--bin/linecount.py2
-rw-r--r--bin/memlogs.py1
-rw-r--r--bin/memoicmp.py9
-rw-r--r--bin/objcounts.py5
-rw-r--r--bin/scons-diff.py5
-rw-r--r--bin/scons-proc.py4
-rw-r--r--bin/scons-test.py5
-rw-r--r--bin/scons-unzip.py1
-rw-r--r--bin/scons_dev_master.py1
-rw-r--r--bin/sfsum11
-rwxr-xr-xbin/svn-bisect.py2
-rw-r--r--bin/update-release-info.py3
-rwxr-xr-xbin/xmlagenda.py1
22 files changed, 50 insertions, 27 deletions
diff --git a/bin/Command.py b/bin/Command.py
index 768caedc..dadd7a9e 100644
--- a/bin/Command.py
+++ b/bin/Command.py
@@ -4,6 +4,7 @@
#
# XXX Describe what the script does here.
#
+from __future__ import print_function
import getopt
import os
diff --git a/bin/SConsDoc.py b/bin/SConsDoc.py
index 453e241d..80f41a58 100644
--- a/bin/SConsDoc.py
+++ b/bin/SConsDoc.py
@@ -24,6 +24,7 @@
#
# Module for handling SCons documentation processing.
#
+from __future__ import print_function
__doc__ = """
This module parses home-brew XML files that document various things
@@ -51,7 +52,7 @@ Builder example:
to indicate a new paragraph.
<example>
- print "this is example code, it will be offset and indented"
+ print("this is example code, it will be offset and indented")
</example>
</summary>
</builder>
@@ -71,7 +72,7 @@ Function example:
&f-FUNCTION; element. It need not be on a line by itself.</para>
<example>
- print "this is example code, it will be offset and indented"
+ print("this is example code, it will be offset and indented")
</example>
</summary>
</scons_function>
@@ -88,7 +89,7 @@ Construction variable example:
&t-VARIABLE; element. It need not be on a line by itself.</para>
<example>
- print "this is example code, it will be offset and indented"
+ print("this is example code, it will be offset and indented")
</example>
</summary>
</cvar>
@@ -105,7 +106,7 @@ Tool example:
&t-TOOL; element. It need not be on a line by itself.</para>
<example>
- print "this is example code, it will be offset and indented"
+ print("this is example code, it will be offset and indented")
</example>
</summary>
</tool>
diff --git a/bin/calibrate.py b/bin/calibrate.py
index 31c04e80..3f9104e1 100644
--- a/bin/calibrate.py
+++ b/bin/calibrate.py
@@ -20,7 +20,7 @@
# 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.
-
+from __future__ import division, print_function
import optparse
import os
diff --git a/bin/caller-tree.py b/bin/caller-tree.py
index 327e6a11..21cda4ba 100644
--- a/bin/caller-tree.py
+++ b/bin/caller-tree.py
@@ -39,6 +39,7 @@
# function at the same time, for example, their counts will intermix.
# So use this to get a *general* idea of who's calling what, not for
# fine-grained performance tuning.
+from __future__ import print_function
import sys
@@ -86,7 +87,7 @@ def print_entry(e, level, calls):
else:
print()
-for e in [ e for e in list(AllCalls.values()) if not e.calls ]:
+for e in [ e for e in AllCalls.values() if not e.calls ]:
print_entry(e, 0, '')
# Local Variables:
diff --git a/bin/docs-create-example-outputs.py b/bin/docs-create-example-outputs.py
index b2dfbea6..64dcf2e2 100644
--- a/bin/docs-create-example-outputs.py
+++ b/bin/docs-create-example-outputs.py
@@ -3,6 +3,7 @@
# Searches through the whole doc/user tree and creates
# all output files for the single examples.
#
+from __future__ import print_function
import os
import sys
diff --git a/bin/docs-update-generated.py b/bin/docs-update-generated.py
index 2b419a47..d22cc32e 100644
--- a/bin/docs-update-generated.py
+++ b/bin/docs-update-generated.py
@@ -6,6 +6,7 @@
# as well as the entity declarations for them.
# Uses scons-proc.py under the hood...
#
+from __future__ import print_function
import os
import SConsDoc
diff --git a/bin/docs-validate.py b/bin/docs-validate.py
index e5d06591..e53a89de 100644
--- a/bin/docs-validate.py
+++ b/bin/docs-validate.py
@@ -3,6 +3,7 @@
# Searches through the whole source tree and validates all
# documentation files against our own XSD in docs/xsd.
#
+from __future__ import print_function
import sys,os
import SConsDoc
diff --git a/bin/install_python.py b/bin/install_python.py
index dca37d0f..5c947ac8 100644
--- a/bin/install_python.py
+++ b/bin/install_python.py
@@ -6,6 +6,7 @@
# This was written for a Linux system (specifically Ubuntu) but should
# be reasonably generic to any POSIX-style system with a /usr/local
# hierarchy.
+from __future__ import print_function
import getopt
import os
diff --git a/bin/install_scons.py b/bin/install_scons.py
index b732193f..7a39e963 100644
--- a/bin/install_scons.py
+++ b/bin/install_scons.py
@@ -17,13 +17,17 @@
# This was written for a Linux system (specifically Ubuntu) but should
# be reasonably generic to any POSIX-style system with a /usr/local
# hierarchy.
+from __future__ import print_function
import getopt
import os
import shutil
import sys
import tarfile
-import urllib.request, urllib.parse, urllib.error
+try:
+ from urllib.request import urlretrieve
+except ImportError: # Python < 3
+ from urllib import urlretrieve
from Command import CommandRunner, Usage
@@ -171,7 +175,7 @@ Usage: install_scons.py [-ahnq] [-d DIR] [-p PREFIX] [VERSION ...]
if not os.path.exists(tar_gz):
if not os.path.exists(downloads_dir):
cmd.run('mkdir %(downloads_dir)s')
- cmd.run((urllib.request.urlretrieve, tar_gz_url, tar_gz),
+ cmd.run((urlretrieve, tar_gz_url, tar_gz),
'wget -O %(tar_gz)s %(tar_gz_url)s')
def extract(tar_gz):
diff --git a/bin/linecount.py b/bin/linecount.py
index 2d478f0c..897f1e8f 100644
--- a/bin/linecount.py
+++ b/bin/linecount.py
@@ -21,7 +21,7 @@
# in each category, the number of non-blank lines, and the number of
# non-comment lines. The last figure (non-comment) lines is the most
# interesting one for most purposes.
-
+from __future__ import division, print_function
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
diff --git a/bin/memlogs.py b/bin/memlogs.py
index 0409dfee..6e68ce07 100644
--- a/bin/memlogs.py
+++ b/bin/memlogs.py
@@ -20,6 +20,7 @@
# 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.
+from future import print_function
import getopt
import sys
diff --git a/bin/memoicmp.py b/bin/memoicmp.py
index 5021c412..1106ac3c 100644
--- a/bin/memoicmp.py
+++ b/bin/memoicmp.py
@@ -2,6 +2,7 @@
#
# A script to compare the --debug=memoizer output found in
# two different files.
+from future import print_function
import sys
@@ -29,14 +30,14 @@ def memoize_cmp(filea, fileb):
ma_o = []
mb_o = []
mab = []
- for k in list(ma.keys()):
- if k in list(mb.keys()):
+ for k in ma.keys():
+ if k in mb.keys():
if k not in mab:
mab.append(k)
else:
ma_o.append(k)
- for k in list(mb.keys()):
- if k in list(ma.keys()):
+ for k in mb.keys():
+ if k in ma.keys():
if k not in mab:
mab.append(k)
else:
diff --git a/bin/objcounts.py b/bin/objcounts.py
index 25b985b8..2bd89236 100644
--- a/bin/objcounts.py
+++ b/bin/objcounts.py
@@ -20,6 +20,7 @@
# 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.
+from __future__ import print_function
import re
import sys
@@ -47,7 +48,7 @@ c1 = fetch_counts(sys.argv[1])
c2 = fetch_counts(sys.argv[2])
common = {}
-for k in list(c1.keys()):
+for k in c1.keys():
try:
common[k] = (c1[k], c2[k])
except KeyError:
@@ -58,7 +59,7 @@ for k in list(c1.keys()):
if not '.' in k:
s = '.'+k
l = len(s)
- for k2 in list(c2.keys()):
+ for k2 in 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 5181fa17..85975011 100644
--- a/bin/scons-diff.py
+++ b/bin/scons-diff.py
@@ -8,6 +8,7 @@
# etc. so that you can diff trees without having to ignore changes in
# version lines.
#
+from __future__ import print_function
import difflib
import getopt
@@ -161,7 +162,7 @@ def diff_file(left, right):
else:
if text:
diff_line(left, right)
- print(text, end=' ')
+ print(text)
elif report_same:
print('Files %s and %s are identical' % (left, right))
@@ -173,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 list(u.keys()) if x[-4:] != '.pyc' ]):
+ for x in sorted([ x for x in 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 19be4c37..b93b25a8 100644
--- a/bin/scons-proc.py
+++ b/bin/scons-proc.py
@@ -9,6 +9,8 @@
# DocBook-formatted generated XML files containing the summary text
# and/or .mod files containing the ENTITY definitions for each item.
#
+from __future__ import print_function
+
import getopt
import os
import re
@@ -106,7 +108,7 @@ Link_Entities_Header = """\
class SCons_XML(object):
def __init__(self, entries, **kw):
self.values = entries
- for k, v in list(kw.items()):
+ for k, v in kw.items():
setattr(self, k, v)
def fopen(self, name):
diff --git a/bin/scons-test.py b/bin/scons-test.py
index 788fc6d1..dd54dd14 100644
--- a/bin/scons-test.py
+++ b/bin/scons-test.py
@@ -14,6 +14,7 @@
# relevant information about the system, the Python version, etc.,
# so that problems on different platforms can be identified sooner.
#
+from __future__ import print_function
import atexit
import getopt
@@ -224,7 +225,7 @@ if format == '--xml':
print(" </environment>")
command = '"%s" runtest.py -q -o - --xml %s' % (sys.executable, runtest_args)
- #print command
+ #print(command)
os.system(command)
print("</scons_test_run>")
@@ -243,7 +244,7 @@ else:
print_version_info("engine", SCons)
command = '"%s" runtest.py %s' % (sys.executable, runtest_args)
- #print command
+ #print(command)
os.system(command)
# Local Variables:
diff --git a/bin/scons-unzip.py b/bin/scons-unzip.py
index 75d3281d..a64179fc 100644
--- a/bin/scons-unzip.py
+++ b/bin/scons-unzip.py
@@ -7,6 +7,7 @@
# I'm using this to make it more convenient to manage working on multiple
# changes on Windows, where I don't have access to my Aegis tools.
#
+from __future__ import print_function
import getopt
import os.path
diff --git a/bin/scons_dev_master.py b/bin/scons_dev_master.py
index 71034ad5..a8862ea8 100644
--- a/bin/scons_dev_master.py
+++ b/bin/scons_dev_master.py
@@ -3,6 +3,7 @@
# A script for turning a generic Ubuntu system into a master for
# SCons development.
+from __future__ import print_function
import getopt
import sys
diff --git a/bin/sfsum b/bin/sfsum
index 2dfa4224..142793af 100644
--- a/bin/sfsum
+++ b/bin/sfsum
@@ -22,6 +22,7 @@
#
# https://sourceforge.net/projects/sitedocs/
#
+from __future__ import print_function
import xml.sax
import xml.sax.saxutils
@@ -121,9 +122,9 @@ if __name__ == '__main__':
# generalized once we figure out other things for this script to do.
bugs = [x for x in Artifacts['Bugs'] if x.status == 'Open']
- print list(Artifacts.keys())
+ print(list(Artifacts.keys()))
- print "%d open bugs" % len(bugs)
+ print("%d open bugs" % len(bugs))
# Sort them into a separate list for each assignee.
Assigned = {}
@@ -141,7 +142,7 @@ if __name__ == '__main__':
except KeyError:
pass
else:
- print " %s" % a
- b.sort(lambda x, y: cmp(x.artifact_id, y.artifact_id))
+ print(" %s" % a)
+ b.sort(key=lambda x, y: (x.artifact_id, y.artifact_id))
for bug in b:
- print " %-6s %s" % (bug.artifact_id, bug.summary)
+ print(" %-6s %s" % (bug.artifact_id, bug.summary))
diff --git a/bin/svn-bisect.py b/bin/svn-bisect.py
index f2623660..dbf8dd97 100755
--- a/bin/svn-bisect.py
+++ b/bin/svn-bisect.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- Python -*-
-
+from __future__ import division, print_function
import sys
from math import log, ceil
diff --git a/bin/update-release-info.py b/bin/update-release-info.py
index f60c187d..b6cf9420 100644
--- a/bin/update-release-info.py
+++ b/bin/update-release-info.py
@@ -56,6 +56,7 @@ In 'post' mode, files are prepared for the next release cycle:
# 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.
+from __future__ import print_function
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -332,7 +333,7 @@ t.replace_assign('deprecated_python_version', str(deprecated_version))
# Update doc/user/main.{in,xml}
-docyears = ', '.join(map(str, iter(list(range(2004, release_date[0] + 1)))))
+docyears = ', '.join(map(str, range(2004, release_date[0] + 1)))
t = UpdateFile(os.path.join('doc', 'user', 'main.in'))
if DEBUG: t.file = '/tmp/main.in'
## TODO debug these
diff --git a/bin/xmlagenda.py b/bin/xmlagenda.py
index 40f5ca14..fcfe53e2 100755
--- a/bin/xmlagenda.py
+++ b/bin/xmlagenda.py
@@ -18,6 +18,7 @@
# Grab the sort bar on the far left (just above the "1" for row one)
# and move it down one row. (Row one becomes a floating header)
# Voila!
+from __future__ import print_function
# The team members
# FIXME: These names really should be external to this script