From 190a8a577934755ff07f9bc58f0b87a65c7f0738 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 16 Oct 2011 18:11:22 -0700 Subject: [PATCH] UpdateChangeLog: update copyright year in header This feature got dropped on commit b655137b7b5f87c11a7e742b7ef0e028a1139677. --- pym/repoman/utilities.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index 5b9eaf741..e4fc1a45b 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -28,6 +28,7 @@ import io from itertools import chain import logging import pwd +import re import sys import time import textwrap @@ -549,6 +550,7 @@ def UpdateChangeLog(pkgdir, category, package, new, removed, changed, msg, prete cl_path = os.path.join(pkgdir, 'ChangeLog') clold_lines = [] clnew_lines = [] + old_header_lines = [] header_lines = [] try: @@ -583,6 +585,12 @@ def UpdateChangeLog(pkgdir, category, package, new, removed, changed, msg, prete 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') @@ -620,9 +628,9 @@ def UpdateChangeLog(pkgdir, category, package, new, removed, changed, msg, prete 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) -- 2.26.2