from itertools import chain
import logging
import pwd
+import re
import sys
import time
import textwrap
cl_path = os.path.join(pkgdir, 'ChangeLog')
clold_lines = []
clnew_lines = []
+ old_header_lines = []
header_lines = []
try:
if not line_strip:
break
+ # update the copyright year
+ old_header_lines = header_lines[:]
+ if len(header_lines) >= 2:
+ header_lines[1] = re.sub(r'^(# Copyright \d\d\d\d)-\d\d\d\d ',
+ r'\1-%s ' % time.strftime('%Y'), header_lines[1])
+
# write new ChangeLog entry
clnew_lines.extend(header_lines)
date = time.strftime('%d %b %Y')
for line in clold_lines:
f.write(line)
- # Now prepend header_lines to clold_lines, for use
+ # Now prepend old_header_lines to clold_lines, for use
# in the unified_diff call below.
- clold_lines = header_lines + clold_lines
+ clold_lines = old_header_lines + clold_lines
for line in clold_file:
f.write(line)