Commit d5f2b542 authored by Victor Stinner's avatar Victor Stinner

Fix reindent-rst.py: it works on binary files

parent 94908bbc
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import sys, re, shutil import sys, re, shutil
ws_re = re.compile(r'\s+(\r?\n)$') ws_re = re.compile(br'\s+(\r?\n)$')
def main(argv=sys.argv): def main(argv=sys.argv):
rv = 0 rv = 0
...@@ -14,7 +14,7 @@ def main(argv=sys.argv): ...@@ -14,7 +14,7 @@ def main(argv=sys.argv):
try: try:
with open(filename, 'rb') as f: with open(filename, 'rb') as f:
lines = f.readlines() lines = f.readlines()
new_lines = [ws_re.sub(r'\1', line) for line in lines] new_lines = [ws_re.sub(br'\1', line) for line in lines]
if new_lines != lines: if new_lines != lines:
print('Fixing %s...' % filename) print('Fixing %s...' % filename)
shutil.copyfile(filename, filename + '.bak') shutil.copyfile(filename, filename + '.bak')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment