summaryrefslogtreecommitdiffstats
path: root/configure.py
diff options
context:
space:
mode:
authorZaheer Chothia <zaheer.chothia@gmail.com>2012-10-18 13:02:48 (GMT)
committerZaheer Chothia <zaheer.chothia@gmail.com>2012-10-18 13:03:20 (GMT)
commit1d5daecfaf1853f87af1d99fb84c347576648474 (patch)
treebfaaf9021a0bfd8bf26d4788812b2a02860d11fb /configure.py
parentb022e789fd9b087e0acbeca502d586d49dd3e2f2 (diff)
downloadNinja-1d5daecfaf1853f87af1d99fb84c347576648474.zip
Ninja-1d5daecfaf1853f87af1d99fb84c347576648474.tar.gz
Ninja-1d5daecfaf1853f87af1d99fb84c347576648474.tar.bz2
Add support for Python 3
Diffstat (limited to 'configure.py')
-rwxr-xr-xconfigure.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/configure.py b/configure.py
index cb0d45e..f716067 100755
--- a/configure.py
+++ b/configure.py
@@ -26,6 +26,14 @@ sys.path.insert(0, 'misc')
import ninja_syntax
+if sys.version_info[0] == 3:
+ import builtins
+ print_ = getattr(builtins, "print")
+else:
+ def print_(*args):
+ sys.stdout.write(" ".join(str(x) for x in args))
+ sys.stdout.write("\n")
+
parser = OptionParser()
platforms = ['linux', 'freebsd', 'solaris', 'mingw', 'windows']
profilers = ['gmon', 'pprof']
@@ -50,7 +58,7 @@ parser.add_option('--with-ninja', metavar='NAME',
default="ninja")
(options, args) = parser.parse_args()
if args:
- print 'ERROR: extra unparsed command-line arguments:', args
+ print_('ERROR: extra unparsed command-line arguments:', args)
sys.exit(1)
platform = options.platform
@@ -256,7 +264,7 @@ if has_re2c():
n.build(src('depfile_parser.cc'), 're2c', src('depfile_parser.in.cc'))
n.build(src('lexer.cc'), 're2c', src('lexer.in.cc'))
else:
- print ("warning: A compatible version of re2c (>= 0.11.3) was not found; "
+ print_("warning: A compatible version of re2c (>= 0.11.3) was not found; "
"changes to src/*.in.cc will not affect your build.")
n.newline()
@@ -436,4 +444,4 @@ if host == 'linux':
n.build('all', 'phony', all_targets)
-print 'wrote %s.' % BUILD_FILENAME
+print_('wrote %s.' % BUILD_FILENAME)