Barry Warsaw pushed to branch master at mailman / Mailman
Commits:
39e55cff by Barry Warsaw at 2015-07-31T17:20:40Z
copybump.py: Allow for no "(C)" in the new copyright statement.
- - - - -
1 changed file:
- copybump.py
Changes:
=====================================
copybump.py
=====================================
--- a/copybump.py
+++ b/copybump.py
@@ -9,28 +9,41 @@ import datetime
FSF = 'by the Free Software Foundation, Inc.'
this_year = datetime.date.today().year
-pyre = re.compile(r'# Copyright \(C\) ((?P<start>\d{4})-)?(?P<end>\d{4})')
+pyre_c = re.compile(r'# Copyright \(C\) ((?P<start>\d{4})-)?(?P<end>\d{4})')
+pyre_n = re.compile(r'# Copyright ((?P<start>\d{4})-)?(?P<end>\d{4})')
+new_c = '# Copyright (C) {}-{} {}'
+new_n = '# Copyright {}-{} {}'
MODE = (stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
+if '--noc' in sys.argv:
+ pyre = pyre_n
+ new = new_n
+ sys.argv.remove('--noc')
+else:
+ pyre = pyre_c
+ new = new_c
+
+
def do_file(path, owner):
permissions = os.stat(path).st_mode & MODE
with open(path) as in_file, open(path + '.out', 'w') as out_file:
try:
for line in in_file:
- mo = pyre.match(line)
- if mo is None:
+ mo_c = pyre_c.match(line)
+ mo_n = pyre_n.match(line)
+ if mo_c is None and mo_n is None:
out_file.write(line)
continue
+ mo = (mo_n if mo_c is None else mo_c)
start = (mo.group('end')
if mo.group('start') is None
else mo.group('start'))
if int(start) == this_year:
out_file.write(line)
continue
- print('# Copyright (C) {}-{} {}'.format(
- start, this_year, owner), file=out_file)
+ print(new.format(start, this_year, owner), file=out_file)
print('=>', path)
for line in in_file:
out_file.write(line)
View it on GitLab:
https://gitlab.com/mailman/mailman/commit/39e55cff34f2556f5fca7c50fb05196fbec03aa6
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org