summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-10-21 00:19:48 -0700
committerZac Medico <zmedico@gentoo.org>2011-10-21 00:19:48 -0700
commitbcde93a8752d428ac2ecdcf2608c0c1d75ee5be2 (patch)
tree5eb30c59bcfa370332ac6b02d40cd8f9bf9aff68
parent4dd5fc4a1fc5f5a9676c212c93244ec8c50288dc (diff)
downloadportage-bcde93a8752d428ac2ecdcf2608c0c1d75ee5be2.tar.gz
portage-bcde93a8752d428ac2ecdcf2608c0c1d75ee5be2.tar.bz2
portage-bcde93a8752d428ac2ecdcf2608c0c1d75ee5be2.zip
_update_copyright_year: optimize no-match case
-rw-r--r--pym/repoman/utilities.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index 9be69011b..eecd46ffa 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -546,9 +546,16 @@ def _update_copyright_year(year, line):
1999 here (in order to be more generic).
"""
is_bytes = isinstance(line, bytes)
+ if is_bytes:
+ if not line.startswith(b'# Copyright '):
+ return line
+ else:
+ if not line.startswith('# Copyright '):
+ return line
+
year = _unicode_encode(year)
line = _unicode_encode(line)
-
+
line = _copyright_re1.sub(br'\1-' + year + b' ', line)
line = _copyright_re2.sub(_copyright_repl(year), line)
if not is_bytes: