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

augmented print statement instead.
This commit is contained in:
Fred Drake 2000-10-26 03:49:15 +00:00
parent bce920129c
commit 33e2c3ece3
1 changed files with 28 additions and 32 deletions

View File

@ -283,11 +283,9 @@ class TokenEater:
options = self.__options
timestamp = time.ctime(time.time())
# common header
try:
sys.stdout = fp
# The time stamp in the header doesn't have the same format
# as that generated by xgettext...
print pot_header % {'time': timestamp, 'version': __version__}
print >>fp, pot_header % {'time': timestamp, 'version': __version__}
for k, v in self.__messages.items():
if not options.writelocations:
pass
@ -295,7 +293,7 @@ class TokenEater:
elif options.locationstyle == options.SOLARIS:
for filename, lineno in v:
d = {'filename': filename, 'lineno': lineno}
print _('# File: %(filename)s, line: %(lineno)d') % d
print >>fp, _('# File: %(filename)s, line: %(lineno)d') % d
elif options.locationstyle == options.GNU:
# fit as many locations on one line, as long as the
# resulting line length doesn't exceeds 'options.width'
@ -306,15 +304,13 @@ class TokenEater:
if len(locline) + len(s) <= options.width:
locline = locline + s
else:
print locline
print >>fp, locline
locline = "#:" + s
if len(locline) > 2:
print locline
print >>fp, locline
# TBD: sorting, normalizing
print 'msgid', normalize(k)
print 'msgstr ""\n'
finally:
sys.stdout = sys.__stdout__
print >>fp, 'msgid', normalize(k)
print >>fp, 'msgstr ""\n'
def main():