From f4b87447a74fa7ee76821bc5e4ddbd6e02b00303 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sun, 27 Dec 2009 19:52:19 +0100 Subject: mkheader.py: Call print as a function, not a builtin --- mkheader.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'mkheader.py') 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__': -- cgit v1.2.3-54-g00ecf