From 23cf656bd1bf8fce19e73ba379abb83febed4c79 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Mon, 26 Nov 2012 11:19:40 +0100 Subject: [PATCH] Automatically update copyright (Closes #549) --- Makefile | 1 + about.html | 2 +- documentation.html | 2 +- download.html | 2 +- faq.html | 2 +- index.html | 2 +- update-copyright | 21 +++++++++++++++++++++ windows.html | 2 +- 8 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 update-copyright diff --git a/Makefile b/Makefile index dc381dc02..71d211290 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ update: python ./generate-download + python ./update-copyright .PHONY: update diff --git a/about.html b/about.html index 26f1c3b9c..a6f87f365 100644 --- a/about.html +++ b/about.html @@ -35,6 +35,6 @@ Creative Commons License
-Copyright © 2006-2011 Ricardo Garcia Gonzalez +Copyright © 2006-2012 Ricardo Garcia Gonzalez diff --git a/documentation.html b/documentation.html index b43444437..4b7b8edc2 100644 --- a/documentation.html +++ b/documentation.html @@ -99,6 +99,6 @@ Creative Commons License
-Copyright © 2006-2011 Ricardo Garcia Gonzalez +Copyright © 2006-2012 Ricardo Garcia Gonzalez diff --git a/download.html b/download.html index 55014697c..9754f7ac3 100644 --- a/download.html +++ b/download.html @@ -28,6 +28,6 @@ Creative Commons License
-Copyright © 2006-2011 Ricardo Garcia Gonzalez +Copyright © 2006-2012 Ricardo Garcia Gonzalez diff --git a/faq.html b/faq.html index 418d0f324..ca7afe036 100644 --- a/faq.html +++ b/faq.html @@ -94,6 +94,6 @@ Please note that Python 2.5 is not supported anymore.

Creative Commons License
-Copyright © 2006-2011 Ricardo Garcia Gonzalez +Copyright © 2006-2012 Ricardo Garcia Gonzalez diff --git a/index.html b/index.html index 885d369bd..208aef366 100644 --- a/index.html +++ b/index.html @@ -26,6 +26,6 @@ Creative Commons License
-Copyright © 2006-2011 Ricardo Garcia Gonzalez +Copyright © 2006-2012 Ricardo Garcia Gonzalez diff --git a/update-copyright b/update-copyright new file mode 100644 index 000000000..a37c4cada --- /dev/null +++ b/update-copyright @@ -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'(?PCopyright © 2006-)(?P[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) diff --git a/windows.html b/windows.html index d9b04c749..49da3aa3a 100644 --- a/windows.html +++ b/windows.html @@ -18,6 +18,6 @@ Creative Commons License
-Copyright © 2006-2011 Ricardo Garcia Gonzalez +Copyright © 2006-2012 Ricardo Garcia Gonzalez