Re: [committed] Add copyright update script to contrib/

2013-02-04 Thread Richard Sandiford
"Bernhard Reutner-Fischer"  writes:
> On 4 February 2013 20:42:55 Richard Sandiford 
>  wrote:
>> ...now that all the output has been approved.
>>
>> Richard
>>
>>
>> contrib/
>>  * update-copyright.pl: New file.
>>
>> Index: contrib/update-copyright.pl
>> ===
>> --- /dev/null2013-01-15 19:11:41.843960094 +
>> +++ contrib/update-copyright.pl  2013-02-04 19:40:37.903547053 +
>> @@ -0,0 +1,766 @@
>> +#!/usr/bin/python
>
> I find this slightly confusing ;)

Hah!  That'll teach me for renaming the thing just before committing. :-)

Now renamed to update-copyright.py, thanks.

Richard


Re: [committed] Add copyright update script to contrib/

2013-02-04 Thread Bernhard Reutner-Fischer
On 4 February 2013 20:42:55 Richard Sandiford 
 wrote:

...now that all the output has been approved.

Richard


contrib/
* update-copyright.pl: New file.

Index: contrib/update-copyright.pl
===
--- /dev/null   2013-01-15 19:11:41.843960094 +
+++ contrib/update-copyright.pl 2013-02-04 19:40:37.903547053 +
@@ -0,0 +1,766 @@
+#!/usr/bin/python


I find this slightly confusing ;)
Cheers,


Sent with AquaMail for Android
http://www.aqua-mail.com




[committed] Add copyright update script to contrib/

2013-02-04 Thread Richard Sandiford
...now that all the output has been approved.

Richard


contrib/
* update-copyright.pl: New file.

Index: contrib/update-copyright.pl
===
--- /dev/null   2013-01-15 19:11:41.843960094 +
+++ contrib/update-copyright.pl 2013-02-04 19:40:37.903547053 +
@@ -0,0 +1,766 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2013 Free Software Foundation, Inc.
+#
+# This script is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+
+# This script adjusts the copyright notices at the top of source files
+# so that they have the form:
+#
+#   Copyright - Free Software Foundation, Inc.
+#
+# It doesn't change code that is known to be maintained elsewhere or
+# that carries a non-FSF copyright.
+#
+# The script also doesn't change testsuite files, except those in
+# libstdc++-v3.  This is because libstdc++-v3 has a conformance testsuite,
+# while most tests in other directories are just things that failed at some
+# point in the past.
+#
+# Pass --this-year to the script if you want it to add the current year
+# to all applicable notices.  Pass --quilt if you are using quilt and
+# want files to be added to the quilt before being changed.
+#
+# By default the script will update all directories for which the
+# output has been vetted.  You can instead pass the names of individual
+# directories, including those that haven't been approved.  So:
+#
+#update-copyright.pl --this-year
+#
+# is the command that would be used at the beginning of a year to update
+# all copyright notices (and possibly at other times to check whether
+# new files have been added with old years).  On the other hand:
+#
+#update-copyright.pl --this-year libjava
+#
+# would run the script on just libjava/.
+#
+# Note that things like --version output strings must be updated before
+# this script is run.  There's already a separate procedure for that.
+
+import os
+import re
+import sys
+import time
+import subprocess
+
+class Errors:
+def __init__ (self):
+self.num_errors = 0
+
+def report (self, filename, string):
+if filename:
+string = filename + ': ' + string
+sys.stderr.write (string + '\n')
+self.num_errors += 1
+
+def ok (self):
+return self.num_errors == 0
+
+class GenericFilter:
+def __init__ (self):
+self.skip_files = set()
+self.skip_dirs = set()
+self.skip_extensions = set()
+self.fossilised_files = set()
+self.own_files = set()
+
+self.skip_files |= set ([
+# Skip licence files.
+'COPYING',
+'COPYING.LIB',
+'COPYING3',
+'COPYING3.LIB',
+'LICENSE',
+'fdl.texi',
+'gpl_v3.texi',
+'fdl-1.3.xml',
+'gpl-3.0.xml',
+
+# Skip auto- and libtool-related files
+'aclocal.m4',
+'compile',
+'config.guess',
+'config.sub',
+'depcomp',
+'install-sh',
+'libtool.m4',
+'ltmain.sh',
+'ltoptions.m4',
+'ltsugar.m4',
+'ltversion.m4',
+'lt~obsolete.m4',
+'missing',
+'mkdep',
+'mkinstalldirs',
+'move-if-change',
+'shlibpath.m4',
+'symlink-tree',
+'ylwrap',
+
+# Skip FSF mission statement, etc.
+'gnu.texi',
+'funding.texi',
+'appendix_free.xml',
+
+# Skip imported texinfo files.
+'texinfo.tex',
+])
+
+
+def get_line_filter (self, dir, filename):
+if filename.startswith ('ChangeLog'):
+# Ignore references to copyright in changelog entries.
+return re.compile ('\t')
+
+return None
+
+def skip_file (self, dir, filename):
+if filename in self.skip_files:
+return True
+
+(base, extension) = os.path.splitext (os.path.join (dir, filename))
+if extension in self.skip_extensions:
+return True
+
+if extension == '.in':
+# Skip .in files produced by automake.
+if os.path.exists (base + '.am'):
+return True
+
+# Skip files produced by autogen
+if (os.path.exists (base + '.def')
+and os.path.exists (base + '.tpl')):
+return True
+
+# Skip configure files produced by autoconf
+if filename == 'configure':
+if os.path.exists (base + '.ac'):
+return True
+if os.path.exists (base + '.in