[Checkins] SVN: z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/ implement listing wanted projects

Wolfgang Schnerring wosc at wosc.de
Tue Jan 27 15:17:13 EST 2009


Log message for revision 95260:
  implement listing wanted projects
  

Changed:
  U   z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/README.txt
  U   z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/recipe.py
  U   z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/tests.py

-=-
Modified: z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/README.txt
===================================================================
--- z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/README.txt	2009-01-27 20:16:50 UTC (rev 95259)
+++ z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/README.txt	2009-01-27 20:17:13 UTC (rev 95260)
@@ -9,8 +9,11 @@
 ...
 ... [kgstest]
 ... recipe = z3c.recipe.kgstest
+... exclude = .*
+... include = zope.dottedname
 ... """)
 >>> print system(buildout)
 Installing kgstest.
-
->>> ls('parts')
+>>> ls('bin')
+- buildout
+- kgstest-zope.dottedname

Modified: z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/recipe.py
===================================================================
--- z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/recipe.py	2009-01-27 20:16:50 UTC (rev 95259)
+++ z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/recipe.py	2009-01-27 20:17:13 UTC (rev 95260)
@@ -1,3 +1,25 @@
+import os
+import popen2
+import re
+
+
+EXCLUDE = ['zope.agxassociation', 'zope.app.css', 'zope.app.demo', \
+           'zope.app.fssync', 'zope.app.recorder', \
+           'zope.app.schemacontent', 'zope.app.sqlexpr', \
+           'zope.app.styleguide', 'zope.app.tests', \
+           'zope.app.versioncontrol', 'zope.app.zopetop', \
+           'zope.bobo', 'zope.browserzcml2', 'zope.fssync', \
+           'zope.generic', 'zope.importtool', 'zope.kgs', \
+           'zope.release', 'zope.pytz', 'zope.timestamp', \
+           'zope.tutorial', 'zope.ucol', 'zope.weakset', \
+           'zope.webdev', 'zope.xmlpickle', 'zope.app.boston',]
+
+
+def string2list(string, default):
+    result = string and string.split('\n') or default
+    return [item.strip() for item in result]
+
+
 class Recipe(object):
     def __init__(self, buildout, name, options):
         self.buildout = buildout
@@ -4,8 +26,37 @@
         self.name = name
         self.options = options
 
+        self.svn_url = self.options.get('svn_url',
+                                        'svn://svn.zope.org/repos/main/')
+        self.exclude = string2list(self.options.get('exclude', ''), EXCLUDE)
+        self.include = string2list(self.options.get('include', ''), [])
+
     def install(self):
-        return []
+        files = []
+        for project in self._wanted_projects():
+            testrunner = os.path.join(self.buildout['buildout']['bin-directory'],
+                                      'kgstest-%s' % project)
+            open(testrunner, 'w').write('foo')
+            files.append(testrunner)
+        return files
 
+    def _wanted_projects(self):
+        projects = []
+        svn_list, _ = popen2.popen2("svn ls %s" % self.svn_url)
+        for project in svn_list:
+            project = project[:-2]
+            skip = False
+            for regex in self.exclude:
+                if re.compile(regex).search(project):
+                    skip = True
+                    break
+            if skip:
+                continue
+            parts = project.split('.')
+            if parts[0] in ('zope', 'grokcore', ):
+                projects.append(project)
+        projects.extend(self.include)
+        return projects
+
     def update(self):
         return []

Modified: z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/tests.py
===================================================================
--- z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/tests.py	2009-01-27 20:16:50 UTC (rev 95259)
+++ z3c.recipe.kgstest/trunk/src/z3c/recipe/kgstest/tests.py	2009-01-27 20:17:13 UTC (rev 95260)
@@ -1,4 +1,5 @@
 import doctest
+import unittest
 import zc.buildout.testing
 
 
@@ -12,10 +13,12 @@
 
 
 def test_suite():
-    return doctest.DocFileSuite('README.txt',
-                                setUp=setUp,
-                                tearDown=tearDown,
-                                optionflags=doctest.ELLIPSIS
-                                | doctest.REPORT_NDIFF
-                                | doctest.NORMALIZE_WHITESPACE)
-
+    ftests = doctest.DocFileSuite('README.txt',
+                                 setUp=setUp,
+                                 tearDown=tearDown,
+                                 optionflags=doctest.ELLIPSIS
+                                 | doctest.REPORT_NDIFF
+                                 | doctest.NORMALIZE_WHITESPACE)
+    suite = unittest.TestSuite()
+    suite.addTests(ftests)
+    return suite



More information about the Checkins mailing list