base: First pass at making nag-once working with python3
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
parent
705bccaa3b
commit
5a25802f9a
1 changed files with 8 additions and 7 deletions
|
@ -7,6 +7,7 @@
|
||||||
# copyright (c) 2011 Red Hat, inc
|
# copyright (c) 2011 Red Hat, inc
|
||||||
# gpl v2 blah blah
|
# gpl v2 blah blah
|
||||||
# skvidal - skvidal@fedoraproject.org
|
# skvidal - skvidal@fedoraproject.org
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import sys
|
import sys
|
||||||
|
@ -86,23 +87,23 @@ def main():
|
||||||
|
|
||||||
if theinput != old_output or (tti and now - old_date > tti):
|
if theinput != old_output or (tti and now - old_date > tti):
|
||||||
if theinput.strip(): # if there is nothing here, don't output and don't drop a \n on the end of it
|
if theinput.strip(): # if there is nothing here, don't output and don't drop a \n on the end of it
|
||||||
print theinput,
|
print(theinput,)
|
||||||
fo = open(mydir + '/output', 'w')
|
fo = open(mydir + '/output', 'w')
|
||||||
fo.write(theinput)
|
fo.write(theinput)
|
||||||
fo.flush()
|
fo.flush()
|
||||||
fo.close()
|
fo.close()
|
||||||
|
|
||||||
|
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print >> sys.stderr, e
|
print(e, file=sys.stderr)
|
||||||
print >> sys.stderr, theinput
|
print(theinput, file=sys.stderr)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
main()
|
main()
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print >> sys.stderr, e
|
print(e, file=sys.stderr)
|
||||||
if not sys.stdin.isatty():
|
if not sys.stdin.isatty():
|
||||||
print >> sys.stderr, sys.stdin.read()
|
print(sys.stdin.read(), file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue