diff options
author | Zaheer Chothia <zaheer.chothia@gmail.com> | 2012-10-18 13:02:48 (GMT) |
---|---|---|
committer | Zaheer Chothia <zaheer.chothia@gmail.com> | 2012-10-18 13:03:20 (GMT) |
commit | 1d5daecfaf1853f87af1d99fb84c347576648474 (patch) | |
tree | bfaaf9021a0bfd8bf26d4788812b2a02860d11fb /configure.py | |
parent | b022e789fd9b087e0acbeca502d586d49dd3e2f2 (diff) | |
download | Ninja-1d5daecfaf1853f87af1d99fb84c347576648474.zip Ninja-1d5daecfaf1853f87af1d99fb84c347576648474.tar.gz Ninja-1d5daecfaf1853f87af1d99fb84c347576648474.tar.bz2 |
Add support for Python 3
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 14 |
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) |