diff options
| author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-06 13:25:26 -0600 |
|---|---|---|
| committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-06 13:25:26 -0600 |
| commit | bb726ca19f434f5055c0efceefe48d89469fcbbe (patch) | |
| tree | 889782afaf67fd5acb5f222969251871c0c46e5a /tools | |
| parent | 7441fa50523f5b4a16c854bf004d675e5bd86ab8 (diff) | |
| download | numpy-bb726ca19f434f5055c0efceefe48d89469fcbbe.tar.gz | |
2to3: Apply `print` fixer.
Add `print_function` to all `from __future__ import ...` statements
and use the python3 print function syntax everywhere.
Closes #3078.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/allocation_tracking/setup.py | 2 | ||||
| -rw-r--r-- | tools/allocation_tracking/track_allocations.py | 2 | ||||
| -rwxr-xr-x | tools/c_coverage/c_coverage_report.py | 6 | ||||
| -rw-r--r-- | tools/commitstats.py | 8 | ||||
| -rw-r--r-- | tools/osxbuild/build.py | 18 | ||||
| -rw-r--r-- | tools/osxbuild/install_and_test.py | 12 | ||||
| -rwxr-xr-x | tools/py3tool.py | 3 | ||||
| -rw-r--r-- | tools/test-installed-numpy.py | 2 | ||||
| -rw-r--r-- | tools/win32build/build.py | 4 | ||||
| -rw-r--r-- | tools/win32build/doall.py | 2 | ||||
| -rw-r--r-- | tools/win32build/misc/x86analysis.py | 16 | ||||
| -rw-r--r-- | tools/win32build/prepare_bootstrap.py | 2 |
12 files changed, 39 insertions, 38 deletions
diff --git a/tools/allocation_tracking/setup.py b/tools/allocation_tracking/setup.py index 87fad4999..a75c95e91 100644 --- a/tools/allocation_tracking/setup.py +++ b/tools/allocation_tracking/setup.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, print_function from distutils.core import setup from distutils.extension import Extension diff --git a/tools/allocation_tracking/track_allocations.py b/tools/allocation_tracking/track_allocations.py index ddd0ffea0..2006217c2 100644 --- a/tools/allocation_tracking/track_allocations.py +++ b/tools/allocation_tracking/track_allocations.py @@ -1,4 +1,4 @@ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import numpy as np import inspect diff --git a/tools/c_coverage/c_coverage_report.py b/tools/c_coverage/c_coverage_report.py index 83fdd1998..9e29a7566 100755 --- a/tools/c_coverage/c_coverage_report.py +++ b/tools/c_coverage/c_coverage_report.py @@ -4,7 +4,7 @@ A script to create C code-coverage reports based on the output of valgrind's callgrind tool. """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function import optparse import os @@ -21,7 +21,7 @@ try: from pygments.formatters import HtmlFormatter has_pygments = True except ImportError: - print "This script requires pygments 0.11 or greater to generate HTML" + print("This script requires pygments 0.11 or greater to generate HTML") has_pygments = False @@ -179,6 +179,6 @@ if __name__ == '__main__': files.write_text(options.directory) if 'html' in formats: if not has_pygments: - print "Pygments 0.11 or later is required to generate HTML" + print("Pygments 0.11 or later is required to generate HTML") sys.exit(1) files.write_html(options.directory) diff --git a/tools/commitstats.py b/tools/commitstats.py index 73e995912..a3de1a6c5 100644 --- a/tools/commitstats.py +++ b/tools/commitstats.py @@ -1,4 +1,4 @@ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function # Run svn log -l <some number> @@ -35,10 +35,10 @@ count.sort() -print "** SciPy and NumPy **" -print "=====================" +print("** SciPy and NumPy **") +print("=====================") for val in count: - print val + print(val) diff --git a/tools/osxbuild/build.py b/tools/osxbuild/build.py index 7aa9312dd..71d37889d 100644 --- a/tools/osxbuild/build.py +++ b/tools/osxbuild/build.py @@ -10,7 +10,7 @@ built using sudo so file permissions are correct when installed on user system. Script will prompt for sudo pwd. """ -from __future__ import division +from __future__ import division, print_function import os import shutil @@ -26,9 +26,9 @@ BUILD_DIR = 'build' DIST_DIR = 'dist' def remove_dirs(): - print 'Removing old build and distribution directories...' - print """The distribution is built as root, so the files have the correct - permissions when installed by the user. Chown them to user for removal.""" + print('Removing old build and distribution directories...') + print("""The distribution is built as root, so the files have the correct + permissions when installed by the user. Chown them to user for removal.""") if os.path.exists(BUILD_DIR): cmd = 'sudo chown -R %s %s' % (getuser(), BUILD_DIR) shellcmd(cmd) @@ -39,12 +39,12 @@ def remove_dirs(): shutil.rmtree(DIST_DIR) def build_dist(): - print 'Building distribution... (using sudo)' + print('Building distribution... (using sudo)') cmd = 'sudo python setupegg.py bdist_mpkg' shellcmd(cmd) def build_dmg(): - print 'Building disk image...' + print('Building disk image...') # Since we removed the dist directory at the start of the script, # our pkg should be the only file there. pkg = os.listdir(DIST_DIR)[0] @@ -60,19 +60,19 @@ def copy_readme(): """Copy a user README with info regarding the website, instead of the developer README which tells one how to build the source. """ - print 'Copy user README.txt for installer.' + print('Copy user README.txt for installer.') shutil.copy(USER_README, DEV_README) def revert_readme(): """Revert the developer README.""" - print 'Reverting README.txt...' + print('Reverting README.txt...') cmd = 'svn revert %s' % DEV_README shellcmd(cmd) def shellcmd(cmd, verbose=True): """Call a shell command.""" if verbose: - print cmd + print(cmd) try: subprocess.check_call(cmd, shell=True) except subprocess.CalledProcessError as err: diff --git a/tools/osxbuild/install_and_test.py b/tools/osxbuild/install_and_test.py index 651298b3f..0243724d9 100644 --- a/tools/osxbuild/install_and_test.py +++ b/tools/osxbuild/install_and_test.py @@ -2,7 +2,7 @@ """Install the built package and run the tests. """ -from __future__ import division +from __future__ import division, print_function import os @@ -16,7 +16,7 @@ clrnull = '\033[0m' def color_print(msg): """Add color to this print output.""" clrmsg = clrgreen + msg + clrnull - print clrmsg + print(clrmsg) distdir = os.path.join(SRC_DIR, DIST_DIR) @@ -34,9 +34,9 @@ pkgpath = os.path.abspath(os.path.join(SRC_DIR, DIST_DIR, pkg)) color_print('Installing package: %s' % pkgpath) # Run the installer -print +print() color_print('Installer requires admin rights, you will be prompted for sudo') -print +print() cmd = 'sudo installer -verbose -package %s -target /' % pkgpath #color_print(cmd) shellcmd(cmd) @@ -44,9 +44,9 @@ shellcmd(cmd) # Null out the PYTHONPATH so we're sure to test the Installed version of numpy os.environ['PYTHONPATH'] = '0' -print +print() color_print('Install successful!') color_print('Running numpy test suite!') -print +print() import numpy numpy.test() diff --git a/tools/py3tool.py b/tools/py3tool.py index 07c01c42b..45a8def4c 100755 --- a/tools/py3tool.py +++ b/tools/py3tool.py @@ -18,7 +18,7 @@ When running py3tool again, only changed files are re-processed, which makes the test-bugfix cycle faster. """ -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function from optparse import OptionParser import shutil @@ -80,6 +80,7 @@ FIXES_TO_SKIP = [ 'import', 'imports', 'imports2', + 'print', ] skip_fixes= [] diff --git a/tools/test-installed-numpy.py b/tools/test-installed-numpy.py index 41d64614f..b8664877e 100644 --- a/tools/test-installed-numpy.py +++ b/tools/test-installed-numpy.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from __future__ import division, absolute_import +from __future__ import division, absolute_import, print_function # A simple script to test the installed version of numpy by calling # 'numpy.test()'. Key features: diff --git a/tools/win32build/build.py b/tools/win32build/build.py index dc12e807d..782ef3d5e 100644 --- a/tools/win32build/build.py +++ b/tools/win32build/build.py @@ -8,7 +8,7 @@ TODO: - make the config configurable with a file """ -from __future__ import division +from __future__ import division, print_function import sys import subprocess @@ -51,7 +51,7 @@ def write_site_cfg(arch): f.close() def build(arch, pyver): - print "Building numpy binary for python %s, arch is %s" % (get_python_exec(pyver), arch) + print("Building numpy binary for python %s, arch is %s" % (get_python_exec(pyver), arch)) get_clean() write_site_cfg(arch) diff --git a/tools/win32build/doall.py b/tools/win32build/doall.py index e9866122e..fbc794db5 100644 --- a/tools/win32build/doall.py +++ b/tools/win32build/doall.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, print_function import subprocess import os diff --git a/tools/win32build/misc/x86analysis.py b/tools/win32build/misc/x86analysis.py index e5eb886b4..39b7cca79 100644 --- a/tools/win32build/misc/x86analysis.py +++ b/tools/win32build/misc/x86analysis.py @@ -5,7 +5,7 @@ # checking the assembly for instructions specific to sse, etc... Obviously, # this won't work all the times (for example, if some instructions are used # only after proper detection of the running CPU, this will give false alarm). -from __future__ import division +from __future__ import division, print_function import sys import re @@ -139,10 +139,10 @@ def main(): analyse(filename) def analyse(filename): - print get_vendor_string() - print "Getting instructions..." + print(get_vendor_string()) + print("Getting instructions...") inst = disassemble(filename) - print "Counting instructions..." + print("Counting instructions...") sse = has_sse(inst) sse2 = has_sse2(inst) sse3 = has_sse3(inst) @@ -151,10 +151,10 @@ def analyse(filename): #print sse #print sse2 #print sse3 - print "SSE3 inst %d" % cntset(sse3) - print "SSE2 inst %d" % cntset(sse2) - print "SSE inst %d" % cntset(sse) - print "Analysed %d instructions" % len(inst) + print("SSE3 inst %d" % cntset(sse3)) + print("SSE2 inst %d" % cntset(sse2)) + print("SSE inst %d" % cntset(sse)) + print("Analysed %d instructions" % len(inst)) if __name__ == '__main__': main() diff --git a/tools/win32build/prepare_bootstrap.py b/tools/win32build/prepare_bootstrap.py index d5822b83e..3984032fd 100644 --- a/tools/win32build/prepare_bootstrap.py +++ b/tools/win32build/prepare_bootstrap.py @@ -1,4 +1,4 @@ -from __future__ import division +from __future__ import division, print_function import os import subprocess |
