[Checkins] SVN: zope.repositorypolicy/trunk/src/zope/repositorypolicy/ Improve fixer tool to install COPYRIGHT.txt and LICENSE.txt.

Christian Theune ct at gocept.com
Tue Mar 16 10:41:06 EDT 2010


Log message for revision 109990:
  Improve fixer tool to install COPYRIGHT.txt and LICENSE.txt.
  

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

-=-
Modified: zope.repositorypolicy/trunk/src/zope/repositorypolicy/copyright.py
===================================================================
--- zope.repositorypolicy/trunk/src/zope/repositorypolicy/copyright.py	2010-03-16 14:39:23 UTC (rev 109989)
+++ zope.repositorypolicy/trunk/src/zope/repositorypolicy/copyright.py	2010-03-16 14:41:06 UTC (rev 109990)
@@ -1,22 +1,33 @@
 # Copyright (c) 2010 Zope Foundation and Contributors
 # See also LICENSE.txt
 
+import StringIO
+import os.path
 import sys
 import zope.repositorypolicy.project
-import StringIO
 
 
 class FixCopyrightHeaders(object):
     """A simple helper to fix source file copyright headers."""
 
-    def __init__(self, working_dir, owner):
+    owner = zope.repositorypolicy.project.Checker.copyright_holder
+
+    def __init__(self, working_dir):
         self.working_dir = working_dir
-        self.owner = owner
 
     def run(self):
         zope.repositorypolicy.project.walk_project_dir(
             self.working_dir, self._fix_file)
 
+        license = open(os.path.join(self.working_dir, 'LICENSE.txt'), 'w')
+        license.write(open(os.path.join(
+            os.path.dirname(__file__), 'data', 'ZPL-2.1.txt')).read())
+        license.close()
+
+        copyright = open(os.path.join(self.working_dir, 'COPYRIGHT.txt'), 'w')
+        copyright.write(self.owner)
+        copyright.close()
+
     def _fix_file(self, path):
         print path
         output = StringIO.StringIO()
@@ -31,4 +42,4 @@
 
 
 def main():
-    FixCopyrightHeaders(sys.argv[1], sys.argv[2]).run()
+    FixCopyrightHeaders(sys.argv[1]).run()

Modified: zope.repositorypolicy/trunk/src/zope/repositorypolicy/project.py
===================================================================
--- zope.repositorypolicy/trunk/src/zope/repositorypolicy/project.py	2010-03-16 14:39:23 UTC (rev 109989)
+++ zope.repositorypolicy/trunk/src/zope/repositorypolicy/project.py	2010-03-16 14:41:06 UTC (rev 109990)
@@ -102,8 +102,8 @@
             content = open(copyright).read().strip()
             if content != self.copyright_holder:
                 self.log.append(
-                    'COPYRIGHT.txt: not assigned to Zope Foundation '
-                    '(found: "%s")' % content)
+                    'COPYRIGHT.txt: not assigned to "%s" '
+                    '(found: "%s")' % (self.copyright_holder, content))
         walk_project_dir(self.working_dir, self._check_copyright_file)
 
     def _check_copyright_file(self, filename):



More information about the checkins mailing list