2015-07-11 07:51:30 +02:00
|
|
|
#!/usr/bin/env python
|
2018-06-16 16:12:18 +02:00
|
|
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
2015-07-11 07:51:30 +02:00
|
|
|
|
2012-10-02 05:16:33 +02:00
|
|
|
import glob
|
|
|
|
import datetime
|
|
|
|
|
|
|
|
this_year = datetime.date.today().year
|
2018-06-12 11:43:13 +02:00
|
|
|
print('current year: %d' % this_year)
|
|
|
|
|
2012-10-02 05:16:33 +02:00
|
|
|
|
|
|
|
def update_file(name):
|
2018-06-12 11:43:13 +02:00
|
|
|
subst = ''
|
|
|
|
f = open(name)
|
|
|
|
for line in f:
|
|
|
|
if 'Copyright (c) ' in line and 'Arvid Norberg' in line:
|
|
|
|
year_idx = line.index('Copyright (c) ')
|
|
|
|
first_year = int(line[year_idx + 14: year_idx + 18])
|
|
|
|
if first_year != this_year:
|
|
|
|
if line[year_idx + 18] == '-':
|
|
|
|
line = line[:year_idx + 19] + str(this_year) + line[year_idx + 23:]
|
|
|
|
else:
|
|
|
|
line = line[:year_idx + 18] + '-' + str(this_year) + line[year_idx + 18:]
|
2012-10-02 05:16:33 +02:00
|
|
|
|
2018-06-12 11:43:13 +02:00
|
|
|
subst += line
|
|
|
|
|
|
|
|
f.close()
|
|
|
|
open(name, 'w+').write(subst)
|
2012-10-02 05:16:33 +02:00
|
|
|
|
2018-06-12 11:43:13 +02:00
|
|
|
|
|
|
|
for i in glob.glob('src/*.cpp') + \
|
|
|
|
glob.glob('include/libtorrent/*.hpp') + \
|
|
|
|
glob.glob('include/libtorrent/extensions/*.hpp') + \
|
|
|
|
glob.glob('include/libtorrent/kademlia/*.hpp') + \
|
|
|
|
glob.glob('src/kademlia/*.cpp') + \
|
|
|
|
['COPYING', 'LICENSE', 'AUTHORS']:
|
|
|
|
update_file(i)
|