diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2009-12-27 19:52:19 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2009-12-27 19:52:19 +0100 |
commit | f4b87447a74fa7ee76821bc5e4ddbd6e02b00303 (patch) | |
tree | e75a6709eecce9b7186f7a8b5932b7810c7fc7ad | |
parent | cd382ae40663ca89aef49bc946de58dc8a6766c1 (diff) |
mkheader.py: Call print as a function, not a builtin
-rwxr-xr-x | mkheader.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mkheader.py b/mkheader.py index 0b5f927..2a6c9ef 100755 --- a/mkheader.py +++ b/mkheader.py @@ -16,19 +16,19 @@ import getopt import re def usage(): - print """usage: %s [OPTION] FILE... + print("""usage: %s [OPTION] FILE... -e launch editor after creating files. Uses editor from $EDITOR envvar. -f overwrite existing files -p do not include full path in header guard name, just the basename -s print generated to stdout instead of writing it to file - -h show this help and exit""" % (os.path.basename(sys.argv[0])) + -h show this help and exit""" % (os.path.basename(sys.argv[0]))) def main(): try: opts, args = getopt.getopt(sys.argv[1:], "efpsh") except getopt.GetoptError, err: - print str(err) + print(str(err)) usage() sys.exit(2) @@ -56,7 +56,7 @@ def main(): assert False, "unhandled option" if to_stdout and launch_editor: - print "Options -e and -s cannot be used together" + print("Options -e and -s cannot be used together") sys.exit(2) for f in args: @@ -66,7 +66,7 @@ def main(): s = os.path.basename(f) if not to_stdout and not overwrite and os.path.exists(f): - print "Header file '%s' already exists. Use -f to override." % f + print("Header file '%s' already exists. Use -f to override." % f) continue q = re.compile('[^a-zA-Z0-9_]') @@ -74,7 +74,7 @@ def main(): if to_stdout: fd = sys.stdout else: - print "Creating %s..." % f + print("Creating %s..." % f) fd = open(f, 'w') fd.write('#ifndef _%s_\n' % define) fd.write('#define _%s_\n\n' % define) @@ -91,13 +91,13 @@ def main(): # Fork an editor for each file as not all editors support # editing multiple files at once (e.g. splitted view in vim) for f in args: - print "Editing header '%s' with '%s'" % (f, editor) + print("Editing header '%s' with '%s'" % (f, editor)) pid = os.fork() if pid == 0: # child process os.execvp(editor, [editor, f]) sys.exit(0) - else: # parent process + else: # parent process os.waitpid(pid, 0) if __name__ == '__main__': |