From: Zac Medico Date: Fri, 21 Oct 2011 07:19:48 +0000 (-0700) Subject: _update_copyright_year: optimize no-match case X-Git-Tag: v2.2.0_alpha70~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bcde93a8752d428ac2ecdcf2608c0c1d75ee5be2;p=portage.git _update_copyright_year: optimize no-match case --- 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: