[Checkins] SVN: zope.repositorypolicy/trunk/src/zope/repositorypolicy/project.py Skip binary files; allow for multiple setup() calls.

Tres Seaver tseaver at palladion.com
Thu Apr 1 13:03:42 EDT 2010


Log message for revision 110414:
  Skip binary files; allow for multiple setup() calls.

Changed:
  U   zope.repositorypolicy/trunk/src/zope/repositorypolicy/project.py

-=-
Modified: zope.repositorypolicy/trunk/src/zope/repositorypolicy/project.py
===================================================================
--- zope.repositorypolicy/trunk/src/zope/repositorypolicy/project.py	2010-04-01 16:47:23 UTC (rev 110413)
+++ zope.repositorypolicy/trunk/src/zope/repositorypolicy/project.py	2010-04-01 17:03:42 UTC (rev 110414)
@@ -2,6 +2,7 @@
 # See also LICENSE.txt
 
 import sys
+import mimetypes
 import os
 import os.path
 import subprocess
@@ -26,7 +27,9 @@
                 continue
             if os.path.isfile(os.path.join(dirname, name)):
                 path = os.path.join(dirname, name)
-                callback(path)
+                m_type, enc = mimetypes.guess_type(path)
+                if m_type is not None:
+                    callback(path)
     os.path.walk(root, visit, ())
 
 
@@ -79,20 +82,22 @@
                              env=environment)
         s.wait()
         metadata = s.stdout.readlines()
-        if len(metadata) != 2:
+        if len(metadata) <= 2 or len(metadata) % 2:
             self.log.append('setup.py: could not extract metadata')
             return
-        license = metadata[0].strip()
-        if not license.startswith(self.license_name):
-            self.log.append(
-                'setup.py: license not declared as "%s" (found: "%s")' %
-                (self.license_name, license))
-        author = metadata[1].strip()
-        if author != self.copyright_holder:
-            self.log.append(
-                'setup.py: author not declared as "%s" '
-                '(found: "%s")' %
-                (self.copyright_holder, author))
+        while metadata:
+            license, author, metadata = metadata[0], metadata[1], metadata[2:]
+            license = license.strip()
+            if not license.startswith(self.license_name):
+                self.log.append(
+                    'setup.py: license not declared as "%s" (found: "%s")' %
+                    (self.license_name, license))
+            author = author.strip()
+            if author != self.copyright_holder:
+                self.log.append(
+                    'setup.py: author not declared as "%s" '
+                    '(found: "%s")' %
+                    (self.copyright_holder, author))
 
     def check_copyright(self):
         """Verifies the copyright assignment to the Zope Foundation



More information about the checkins mailing list