Merged revisions 85766-85767 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85766 | georg.brandl | 2010-10-21 09:40:03 +0200 (Do, 21 Okt 2010) | 1 line
#10159: sort completion matches before comparing to dir() result.
........
r85767 | georg.brandl | 2010-10-21 14:49:28 +0200 (Do, 21 Okt 2010) | 1 line
#9095, #8912, #8999: add support in patchcheck for Mercurial checkouts, C file reindenting, and docs whitespace fixing.
........
diff --git a/Tools/scripts/reindent-rst.py b/Tools/scripts/reindent-rst.py
index bf431d9..ceb84bf 100755
--- a/Tools/scripts/reindent-rst.py
+++ b/Tools/scripts/reindent-rst.py
@@ -3,27 +3,12 @@
# Make a reST file compliant to our pre-commit hook.
# Currently just remove trailing whitespace.
-from __future__ import with_statement
-import sys, re, shutil
+import sys
-ws_re = re.compile(r'\s+(\r?\n)$')
+import patchcheck
def main(argv=sys.argv):
- rv = 0
- for filename in argv[1:]:
- try:
- with open(filename, 'rb') as f:
- lines = f.readlines()
- new_lines = [ws_re.sub(r'\1', line) for line in lines]
- if new_lines != lines:
- 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)
- rv = 1
- return rv
+ patchcheck.normalize_docs_whitespace(argv[1:])
if __name__ == '__main__':
sys.exit(main())