gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/metacode copyrighter.py


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz/metacode copyrighter.py
Date: Fri, 21 Feb 2003 10:50:31 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        03/02/21 10:50:31

Modified files:
        metacode       : copyrighter.py 

Log message:
        Show the files lacking copyright notices

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/metacode/copyrighter.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gzz/metacode/copyrighter.py
diff -u gzz/metacode/copyrighter.py:1.2 gzz/metacode/copyrighter.py:1.3
--- gzz/metacode/copyrighter.py:1.2     Fri Sep 13 07:48:32 2002
+++ gzz/metacode/copyrighter.py Fri Feb 21 10:50:30 2003
@@ -33,10 +33,19 @@
 The idea is to relieve us from the task of manually inserting
 the copyright statement everywhere.
 
+Additionally, it checks all files with the suffixes
+.java
+.py
+.test
+.pl
+
+for having the text "General Public License" in the first three lines
+and dies if it is not.
+
 Best run as 'make copyrighted'.
 """
 
-import sys, os, os.path, time
+import sys, os, os.path, time, re
 
 year = time.localtime()[0]
 
@@ -71,7 +80,9 @@
     for name in names:
         file = os.path.join(dir, name)
         if os.path.isdir(file): continue
-        first = open(file, 'r').read(7)
+        firstlines = open(file, 'r').readlines(500)
+       if not len(firstlines): continue
+       first = firstlines[0]
 
         if first.startswith('//(c):') or first.startswith('#(c):') or \
           first.startswith('// (c) '):
@@ -108,7 +119,13 @@
 
             print "Inserting copyright statement into file %s" % (file,)
             open(file, 'w').write(text)
-
+       else:
+           # Is this a file type that needs to be copyrighted?
+           if re.search('\.(?:java|py|test|pl|PL)$', name):
+               m = max([re.search("General Public License", line) 
+                           for line in firstlines])
+               if m == None:
+                   print dir+"/"+name+":1: not copyrighted"
 
 if len(sys.argv) > 1:
     dir = sys.argv[1]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]