Commit fc681dea authored by Tim Peters's avatar Tim Peters

Add zodb.tex to the files altered.

In replace(), print feedback to stderr, since fileinput
hijacks stdout.
parent 9fd34bd2
...@@ -22,23 +22,30 @@ import re ...@@ -22,23 +22,30 @@ import re
# In file filename, replace the first occurrence of regexp pat with # In file filename, replace the first occurrence of regexp pat with
# string repl. # string repl.
def replace(filename, pat, repl): def replace(filename, pat, repl):
from sys import stderr as e # fileinput hijacks sys.stdout
foundone = False foundone = False
for line in fileinput.input([filename], inplace=True, backup="~"): for line in fileinput.input([filename], inplace=True, backup="~"):
if foundone: if foundone:
print line, print line,
else: else:
new = re.sub(pat, repl, line) match = re.search(pat, line)
if new != line: if match is not None:
foundone = True foundone = True
print "In %r, replaced:" % filename
print " ", line new = re.sub(pat, repl, line)
print "by:" print new,
print " ", new
print new, print >> e, "In %r, replaced:" % filename
print >> e, " ", line
print >> e, "by:"
print >> e, " ", new
else:
print line,
if not foundone: if not foundone:
print "*" * 60, "Oops!" print >> e, "*" * 60, "Oops!"
print " Failed to find %r in %r" % (pat, filename) print >> e, " Failed to find %r in %r" % (pat, filename)
def compute_zeoversion(version): def compute_zeoversion(version):
# ZEO version's trail ZODB versions by one full revision. # ZEO version's trail ZODB versions by one full revision.
...@@ -69,7 +76,9 @@ def main(args): ...@@ -69,7 +76,9 @@ def main(args):
replace("NEWS.txt", replace("NEWS.txt",
r"^Release date: .*", r"^Release date: .*",
"Release date: %s" % date) "Release date: %s" % date)
replace("doc/guide/zodb.tex",
r"\\release{\S+}",
r"\release{%s}" % version)
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
main(sys.argv[1:]) main(sys.argv[1:])
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