diff options
author | Anthony King <anthonydking@slimroms.net> | 2015-10-31 15:25:51 -0400 |
---|---|---|
committer | Tom Powell <zifnab@zifnab06.net> | 2016-01-04 10:54:37 -0800 |
commit | b1579843dd49ec2ee50e799754f69b2a6f1aab59 (patch) | |
tree | 9854322304df8260eefa59c9cd62b02a4e5f48c5 /tools | |
parent | 71fa3801292e323c8a5b263db93ae5cc67cf5d28 (diff) | |
download | build-b1579843dd49ec2ee50e799754f69b2a6f1aab59.zip build-b1579843dd49ec2ee50e799754f69b2a6f1aab59.tar.gz build-b1579843dd49ec2ee50e799754f69b2a6f1aab59.tar.bz2 |
py3: java-event-log-tags
Change-Id: I0bf4cbe990c21b6d57e54e96ea62c56ca2d41b86
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/java-event-log-tags.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/tools/java-event-log-tags.py b/tools/java-event-log-tags.py index f364751..6ac69bd 100755 --- a/tools/java-event-log-tags.py +++ b/tools/java-event-log-tags.py @@ -23,37 +23,43 @@ tags in the given input file. -h to display this usage message and exit. """ -import cStringIO +from __future__ import print_function + import getopt import os import os.path import re import sys +try: + from cStringIO import StringIO +except ImportError: + from io import StringIO + import event_log_tags output_file = None try: opts, args = getopt.getopt(sys.argv[1:], "ho:") -except getopt.GetoptError, err: - print str(err) - print __doc__ +except getopt.GetoptError as err: + print(str(err)) + print(__doc__) sys.exit(2) for o, a in opts: if o == "-h": - print __doc__ + print(__doc__) sys.exit(2) elif o == "-o": output_file = a else: - print >> sys.stderr, "unhandled option %s" % (o,) + print("unhandled option %s" % o, file=sys.stderr) sys.exit(1) if len(args) != 2: - print "need exactly two input files, not %d" % (len(args),) - print __doc__ + print("need exactly two input files, not %d" % len(args)) + print(__doc__) sys.exit(1) fn = args[0] @@ -85,10 +91,10 @@ if "javadoc_hide" in tagfile.options: if tagfile.errors: for fn, ln, msg in tagfile.errors: - print >> sys.stderr, "%s:%d: error: %s" % (fn, ln, msg) + print("%s:%d: error: %s" % (fn, ln, msg), file=sys.stderr) sys.exit(1) -buffer = cStringIO.StringIO() +buffer = StringIO() buffer.write("/* This file is auto-generated. DO NOT MODIFY.\n" " * Source file: %s\n" " */\n\n" % (fn,)) |