Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2007-06-24 10:36:50 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2007-06-24 10:36:50 (GMT)
commit3dd5ecddeecfdd3d8a8492fe4fc763c07627a783 (patch)
treee6b025f299f6f357ac3214802312631948c93d61
parentc51290b51d99330d71a4107db7709aabc386cbb2 (diff)
Check also C files
-rw-r--r--lib/.license1
-rwxr-xr-xmaint-helper.py45
2 files changed, 35 insertions, 11 deletions
diff --git a/lib/.license b/lib/.license
new file mode 100644
index 0000000..6989ebe
--- /dev/null
+++ b/lib/.license
@@ -0,0 +1 @@
+LGPL
diff --git a/maint-helper.py b/maint-helper.py
index e1d2593..0db859b 100755
--- a/maint-helper.py
+++ b/maint-helper.py
@@ -51,8 +51,10 @@ def cmd_build_snapshot():
os.rename('%s-%s.tar.bz2' % (name, version), tarball)
def check_licenses(path, license, missing):
- matchers = { 'LGPL' : 'GNU Lesser General Public',
- 'GPL' : 'GNU General Public License' }
+ matchers = { 'LGPL' : [ 'GNU Lesser General Public',
+ 'GNU General Library License' ],
+ 'GPL' : [ 'GNU General Public License' ] }
+ source_exts = [ '.py', '.c', '.h', '.cpp' ]
license_file = os.path.join(path, '.license')
if os.path.isfile(license_file):
@@ -63,17 +65,38 @@ def check_licenses(path, license, missing):
for item in os.listdir(path):
full_path = os.path.join(path, item)
- if item.endswith('.py'):
- f = open(full_path, 'r')
- source = f.read()
- if source.find(matchers[license]) == -1:
- if not missing.has_key(license):
- missing[license] = []
- missing[license].append(full_path)
- f.close()
-
if os.path.isdir(full_path):
check_licenses(full_path, license, missing)
+ else:
+ check_source = False
+ for ext in source_exts:
+ if item.endswith(ext):
+ check_source = True
+
+ # Special cases.
+ if item.find('marshal') > 0 or \
+ item.startswith('egg') > 0:
+ check_source = False
+
+ if check_source:
+ f = open(full_path, 'r')
+ source = f.read()
+ f.close()
+
+ miss_license = True
+
+ for matcher in matchers[license]:
+ if source.find(matcher) > 0:
+ miss_license = False
+
+ # Special cases.
+ if source.find('THIS FILE IS GENERATED') > 0:
+ miss_license = False
+
+ if miss_license:
+ if not missing.has_key(license):
+ missing[license] = []
+ missing[license].append(full_path)
def cmd_check_licenses():
missing = {}