comparison scripts/logformat.py @ 7844:a8e6bb9ee9ea

future: use Python print function
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 18 Aug 2019 20:25:18 +0200
parents 63b548dd5ef3
children aa6f17a53b49
comparison
equal deleted inserted replaced
7843:e2e5140704fc 7844:a8e6bb9ee9ea
1 #!/usr/bin/env python2 1 #!/usr/bin/env python2
2
3 from __future__ import print_function
2 4
3 import re 5 import re
4 import sys 6 import sys
5 7
6 8
36 open(f, 'w').write(s) 38 open(f, 'w').write(s)
37 39
38 40
39 if __name__ == '__main__': 41 if __name__ == '__main__':
40 if len(sys.argv) < 2: 42 if len(sys.argv) < 2:
41 print 'Cleanup of superfluous % formatting of log statements.' 43 print('Cleanup of superfluous % formatting of log statements.')
42 print 'Usage:' 44 print('Usage:')
43 print ''' hg revert `hg loc '*.py'|grep -v logformat.py` && scripts/logformat.py `hg loc '*.py'` && hg diff''' 45 print(''' hg revert `hg loc '*.py'|grep -v logformat.py` && scripts/logformat.py `hg loc '*.py'` && hg diff''')
44 raise SystemExit(1) 46 raise SystemExit(1)
45 47
46 for f in sys.argv[1:]: 48 for f in sys.argv[1:]:
47 rewrite(f) 49 rewrite(f)