[Python-checkins] r70921 - python/branches/py3k/Tools/scripts/reindent-rst.py
georg.brandl
python-checkins at python.org
Wed Apr 1 00:46:50 CEST 2009
Author: georg.brandl
Date: Wed Apr 1 00:46:50 2009
New Revision: 70921
Log:
Run 2to3 over new script.
Modified:
python/branches/py3k/Tools/scripts/reindent-rst.py
Modified: python/branches/py3k/Tools/scripts/reindent-rst.py
==============================================================================
--- python/branches/py3k/Tools/scripts/reindent-rst.py (original)
+++ python/branches/py3k/Tools/scripts/reindent-rst.py Wed Apr 1 00:46:50 2009
@@ -3,7 +3,7 @@
# Make a reST file compliant to our pre-commit hook.
# Currently just remove trailing whitespace.
-from __future__ import with_statement
+
import sys, re, shutil
ws_re = re.compile(r'\s+(\r?\n)$')
@@ -16,12 +16,12 @@
lines = f.readlines()
new_lines = [ws_re.sub(r'\1', line) for line in lines]
if new_lines != lines:
- print 'Fixing %s...' % filename
+ print('Fixing %s...' % filename)
shutil.copyfile(filename, filename + '.bak')
with open(filename, 'wb') as f:
f.writelines(new_lines)
- except Exception, err:
- print 'Cannot fix %s: %s' % (filename, err)
+ except Exception as err:
+ print('Cannot fix %s: %s' % (filename, err))
rv = 1
return rv
More information about the Python-checkins
mailing list