Automatically update copyright (Closes #549)
This commit is contained in:
parent
41ff5333f7
commit
23cf656bd1
1
Makefile
1
Makefile
|
@ -1,5 +1,6 @@
|
||||||
update:
|
update:
|
||||||
python ./generate-download
|
python ./generate-download
|
||||||
|
python ./update-copyright
|
||||||
|
|
||||||
.PHONY: update
|
.PHONY: update
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,6 @@
|
||||||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
|
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
|
||||||
<img alt="Creative Commons License" style="border-width:0"
|
<img alt="Creative Commons License" style="border-width:0"
|
||||||
src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a><br />
|
src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a><br />
|
||||||
Copyright © 2006-2011 Ricardo Garcia Gonzalez</div>
|
Copyright © 2006-2012 Ricardo Garcia Gonzalez</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -99,6 +99,6 @@
|
||||||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
|
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
|
||||||
<img alt="Creative Commons License" style="border-width:0"
|
<img alt="Creative Commons License" style="border-width:0"
|
||||||
src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a><br />
|
src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a><br />
|
||||||
Copyright © 2006-2011 Ricardo Garcia Gonzalez</div>
|
Copyright © 2006-2012 Ricardo Garcia Gonzalez</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -28,6 +28,6 @@
|
||||||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
|
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
|
||||||
<img alt="Creative Commons License" style="border-width:0"
|
<img alt="Creative Commons License" style="border-width:0"
|
||||||
src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a><br />
|
src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a><br />
|
||||||
Copyright © 2006-2011 Ricardo Garcia Gonzalez</div>
|
Copyright © 2006-2012 Ricardo Garcia Gonzalez</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
2
faq.html
2
faq.html
|
@ -94,6 +94,6 @@ Please note that Python 2.5 is not supported anymore.</p>
|
||||||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
|
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
|
||||||
<img alt="Creative Commons License" style="border-width:0"
|
<img alt="Creative Commons License" style="border-width:0"
|
||||||
src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a><br />
|
src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a><br />
|
||||||
Copyright © 2006-2011 Ricardo Garcia Gonzalez</div>
|
Copyright © 2006-2012 Ricardo Garcia Gonzalez</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -26,6 +26,6 @@
|
||||||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
|
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
|
||||||
<img alt="Creative Commons License" style="border-width:0"
|
<img alt="Creative Commons License" style="border-width:0"
|
||||||
src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a><br />
|
src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a><br />
|
||||||
Copyright © 2006-2011 Ricardo Garcia Gonzalez</div>
|
Copyright © 2006-2012 Ricardo Garcia Gonzalez</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import glob
|
||||||
|
import io # For Python 2 compatibilty
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
year = str(datetime.datetime.now().year)
|
||||||
|
for fn in glob.glob('*.html'):
|
||||||
|
with io.open(fn, encoding='utf-8') as f:
|
||||||
|
content = f.read()
|
||||||
|
newc = re.sub(ur'(?P<copyright>Copyright © 2006-)(?P<year>[0-9]{4})', u'Copyright © 2006-' + year, content)
|
||||||
|
if content != newc:
|
||||||
|
tmpFn = fn + '.part'
|
||||||
|
with io.open(tmpFn, 'wt', encoding='utf-8') as outf:
|
||||||
|
outf.write(newc)
|
||||||
|
os.rename(tmpFn, fn)
|
|
@ -18,6 +18,6 @@
|
||||||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
|
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
|
||||||
<img alt="Creative Commons License" style="border-width:0"
|
<img alt="Creative Commons License" style="border-width:0"
|
||||||
src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a><br />
|
src="http://i.creativecommons.org/l/by-nc-sa/3.0/80x15.png" /></a><br />
|
||||||
Copyright © 2006-2011 Ricardo Garcia Gonzalez</div>
|
Copyright © 2006-2012 Ricardo Garcia Gonzalez</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue