diff options
author | Collin Winter <collinw@gmail.com> | 2007-08-03 17:06:41 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-08-03 17:06:41 (GMT) |
commit | 6afaeb757af0dbd8508a0f2352ade61e41bec84c (patch) | |
tree | f1b31bc7138b17ff39791bbb45aa81583c3b6e46 /Tools/i18n/pygettext.py | |
parent | e5d0e8431f929cad2da77b63fe1b7dc0ff21a428 (diff) | |
download | cpython-6afaeb757af0dbd8508a0f2352ade61e41bec84c.zip cpython-6afaeb757af0dbd8508a0f2352ade61e41bec84c.tar.gz cpython-6afaeb757af0dbd8508a0f2352ade61e41bec84c.tar.bz2 |
Convert print statements to function calls in Tools/.
Diffstat (limited to 'Tools/i18n/pygettext.py')
-rwxr-xr-x | Tools/i18n/pygettext.py | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/Tools/i18n/pygettext.py b/Tools/i18n/pygettext.py index 24f1ce1..cc25239 100755 --- a/Tools/i18n/pygettext.py +++ b/Tools/i18n/pygettext.py @@ -197,9 +197,9 @@ msgstr "" def usage(code, msg=''): - print >> sys.stderr, __doc__ % globals() + print(__doc__ % globals(), file=sys.stderr) if msg: - print >> sys.stderr, msg + print(msg, file=sys.stderr) sys.exit(code) @@ -423,13 +423,13 @@ class TokenEater: elif ttype not in [tokenize.COMMENT, token.INDENT, token.DEDENT, token.NEWLINE, tokenize.NL]: # warn if we see anything else than STRING or whitespace - print >> sys.stderr, _( + print(_( '*** %(file)s:%(lineno)s: Seen unexpected token "%(token)s"' ) % { 'token': tstring, 'file': self.__curfile, 'lineno': self.__lineno - } + }, file=sys.stderr) self.__state = self.__waiting def __addentry(self, msg, lineno=None, isdocstring=0): @@ -448,7 +448,7 @@ class TokenEater: timestamp = time.strftime('%Y-%m-%d %H:%M+%Z') # The time stamp in the header doesn't have the same format as that # generated by xgettext... - print >> fp, pot_header % {'time': timestamp, 'version': __version__} + print(pot_header % {'time': timestamp, 'version': __version__}, file=fp) # Sort the entries. First sort each particular entry's keys, then # sort all the entries by their first item. reverse = {} @@ -477,8 +477,8 @@ class TokenEater: elif options.locationstyle == options.SOLARIS: for filename, lineno in v: d = {'filename': filename, 'lineno': lineno} - print >>fp, _( - '# File: %(filename)s, line: %(lineno)d') % d + print(_( + '# File: %(filename)s, line: %(lineno)d') % d, file=fp) elif options.locationstyle == options.GNU: # fit as many locations on one line, as long as the # resulting line length doesn't exceeds 'options.width' @@ -489,14 +489,14 @@ class TokenEater: if len(locline) + len(s) <= options.width: locline = locline + s else: - print >> fp, locline + print(locline, file=fp) locline = "#:" + s if len(locline) > 2: - print >> fp, locline + print(locline, file=fp) if isdocstring: - print >> fp, '#, docstring' - print >> fp, 'msgid', normalize(k) - print >> fp, 'msgstr ""\n' + print('#, docstring', file=fp) + print('msgid', normalize(k), file=fp) + print('msgstr ""\n', file=fp) @@ -570,7 +570,7 @@ def main(): elif opt in ('-v', '--verbose'): options.verbose = 1 elif opt in ('-V', '--version'): - print _('pygettext.py (xgettext for Python) %s') % __version__ + print(_('pygettext.py (xgettext for Python) %s') % __version__) sys.exit(0) elif opt in ('-w', '--width'): try: @@ -603,8 +603,8 @@ def main(): options.toexclude = fp.readlines() fp.close() except IOError: - print >> sys.stderr, _( - "Can't read --exclude-file: %s") % options.excludefilename + print(_( + "Can't read --exclude-file: %s") % options.excludefilename, file=sys.stderr) sys.exit(1) else: options.toexclude = [] @@ -623,12 +623,12 @@ def main(): for filename in args: if filename == '-': if options.verbose: - print _('Reading standard input') + print(_('Reading standard input')) fp = sys.stdin closep = 0 else: if options.verbose: - print _('Working on %s') % filename + print(_('Working on %s') % filename) fp = open(filename) closep = 1 try: @@ -636,8 +636,8 @@ def main(): try: tokenize.tokenize(fp.readline, eater) except tokenize.TokenError as e: - print >> sys.stderr, '%s: %s, line %d, column %d' % ( - e[0], filename, e[1][0], e[1][1]) + print('%s: %s, line %d, column %d' % ( + e[0], filename, e[1][0], e[1][1]), file=sys.stderr) finally: if closep: fp.close() |