[Sugar-devel] [PATCH sugar-base 13/17] maint-helper: rename parameter to avoid name clash with built-in function

Sascha Silbe sascha-pgp at silbe.org
Sat Oct 16 07:30:26 EDT 2010


Renaming license to license_name even makes the code slightly easier to
understand.

Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>

diff --git a/maint-helper.py b/maint-helper.py
index 4f8a0be..8bd35ce 100755
--- a/maint-helper.py
+++ b/maint-helper.py
@@ -129,21 +129,21 @@ def cmd_build_snapshot():
     print 'Done.'
 
 
-def check_licenses(path, license, missing):
+def check_licenses(path, license_name, missing):
     matchers = {'LGPL': 'GNU Lesser General Public License',
         'GPL': 'GNU General Public License'}
 
     license_file = os.path.join(path, '.license')
     if os.path.isfile(license_file):
         f = open(license_file, 'r')
-        license = f.readline().strip()
+        license_name = f.readline().strip()
         f.close()
 
     for item in os.listdir(path):
         full_path = os.path.join(path, item)
 
         if os.path.isdir(full_path):
-            check_licenses(full_path, license, missing)
+            check_licenses(full_path, license_name, missing)
         else:
             check_source = is_source(item)
 
@@ -158,7 +158,7 @@ def check_licenses(path, license, missing):
                 f.close()
 
                 miss_license = True
-                if source.find(matchers[license]) > 0:
+                if source.find(matchers[license_name]) > 0:
                     miss_license = False
 
                 # Special cases.
@@ -166,9 +166,9 @@ def check_licenses(path, license, missing):
                     miss_license = False
 
                 if miss_license:
-                    if license not in missing:
-                        missing[license] = []
-                    missing[license].append(full_path)
+                    if license_name not in missing:
+                        missing[license_name] = []
+                    missing[license_name].append(full_path)
 
 
 def cmd_check_licenses():
-- 
1.7.1



More information about the Sugar-devel mailing list