_update_copyright_year: optimize no-match case
authorZac Medico <zmedico@gentoo.org>
Fri, 21 Oct 2011 07:19:48 +0000 (00:19 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 21 Oct 2011 07:19:48 +0000 (00:19 -0700)
pym/repoman/utilities.py

index 9be69011b043c38430e4465b3ab9781b12e07823..eecd46ffa7f7523bfd4185cc446950c528fb80f0 100644 (file)
@@ -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: