Kaydet (Commit) 33e2c3ec authored tarafından Fred Drake's avatar Fred Drake

Remove bogus stdout redirection and use of sys.__stdout__; use

augmented print statement instead.
üst bce92012
...@@ -283,38 +283,34 @@ class TokenEater: ...@@ -283,38 +283,34 @@ class TokenEater:
options = self.__options options = self.__options
timestamp = time.ctime(time.time()) timestamp = time.ctime(time.time())
# common header # common header
try: # The time stamp in the header doesn't have the same format
sys.stdout = fp # as that generated by xgettext...
# The time stamp in the header doesn't have the same format print >>fp, pot_header % {'time': timestamp, 'version': __version__}
# as that generated by xgettext... for k, v in self.__messages.items():
print pot_header % {'time': timestamp, 'version': __version__} if not options.writelocations:
for k, v in self.__messages.items(): pass
if not options.writelocations: # location comments are different b/w Solaris and GNU:
pass elif options.locationstyle == options.SOLARIS:
# location comments are different b/w Solaris and GNU: for filename, lineno in v:
elif options.locationstyle == options.SOLARIS: d = {'filename': filename, 'lineno': lineno}
for filename, lineno in v: print >>fp, _('# File: %(filename)s, line: %(lineno)d') % d
d = {'filename': filename, 'lineno': lineno} elif options.locationstyle == options.GNU:
print _('# File: %(filename)s, line: %(lineno)d') % d # fit as many locations on one line, as long as the
elif options.locationstyle == options.GNU: # resulting line length doesn't exceeds 'options.width'
# fit as many locations on one line, as long as the locline = '#:'
# resulting line length doesn't exceeds 'options.width' for filename, lineno in v:
locline = '#:' d = {'filename': filename, 'lineno': lineno}
for filename, lineno in v: s = _(' %(filename)s:%(lineno)d') % d
d = {'filename': filename, 'lineno': lineno} if len(locline) + len(s) <= options.width:
s = _(' %(filename)s:%(lineno)d') % d locline = locline + s
if len(locline) + len(s) <= options.width: else:
locline = locline + s print >>fp, locline
else: locline = "#:" + s
print locline if len(locline) > 2:
locline = "#:" + s print >>fp, locline
if len(locline) > 2: # TBD: sorting, normalizing
print locline print >>fp, 'msgid', normalize(k)
# TBD: sorting, normalizing print >>fp, 'msgstr ""\n'
print 'msgid', normalize(k)
print 'msgstr ""\n'
finally:
sys.stdout = sys.__stdout__
def main(): def main():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment