[Checkins] SVN: Sandbox/thefunny42/kgs.test/trunk/build.py Various improvements.

Sylvain Viollon sylvain at infrae.com
Tue Jan 27 02:30:30 EST 2009


Log message for revision 95075:
  Various improvements.
  
  

Changed:
  U   Sandbox/thefunny42/kgs.test/trunk/build.py

-=-
Modified: Sandbox/thefunny42/kgs.test/trunk/build.py
===================================================================
--- Sandbox/thefunny42/kgs.test/trunk/build.py	2009-01-27 07:13:58 UTC (rev 95074)
+++ Sandbox/thefunny42/kgs.test/trunk/build.py	2009-01-27 07:30:29 UTC (rev 95075)
@@ -5,11 +5,12 @@
 from pkg_resources import Environment, WorkingSet
 from zc.buildout import easy_install
 
-
-ZOPE3_SVN = os.getenv('ZOPE3_SVN', 'svn://svn.zope.org/repos/main/')
-EGG_CACHE = os.getenv('EGG_CACHE', '/Users/sylvain/Library/Buildout/eggs')
+# Configuration
+ZOPE3_SVN = os.getenv('ZOPE3_SVN',
+                      'svn://svn.zope.org/repos/main/')
+EGG_CACHE = os.getenv('PYTHON_CACHE_EGG',
+                      '/Users/sylvain/Library/Buildout/eggs')
 DEVELOP_EGG = 'develop-eggs'
-NEWEST = False
 BLACKLIST = ['zope.agxassociation', 'zope.app.css', 'zope.app.demo', \
                  'zope.app.fssync', 'zope.app.recorder', \
                  'zope.app.schemacontent', 'zope.app.sqlexpr', \
@@ -23,7 +24,8 @@
 DELETE_LIST = ['zope.app.boston',]
 IGNORED = BLACKLIST + DELETE_LIST
 
-wanted = []
+# Collect project
+projects = []
 svn_list, _ = popen2.popen2("svn ls %s" % ZOPE3_SVN)
 for project in svn_list:
     project = project[:-2]
@@ -31,9 +33,9 @@
         continue
     parts = project.split('.')
     if parts[0] in ('zope', 'grokcore', ):
-        wanted.append(project)
+        projects.append(project)
 
-
+# Write buildout and makefile
 kgs_conf = open('kgs.cfg', 'w')
 trunk_conf = open('trunk.cfg', 'w')
 makefile = open('Makefile', 'w')
@@ -54,8 +56,7 @@
 develop = 
 """)
 
-
-for project in wanted:
+for project in projects:
     script_name = project.replace('.', '-')
     kgs_conf.write("  test-%s\n" % script_name)
     makefile.write(" test-%s" % script_name)
@@ -67,8 +68,11 @@
 	$(CURDIR)/bin/$@
 """)
 
-def to_test(project, need_test):
-    if need_test:
+if not os.path.isdir(DEVELOP_EGG):
+    os.mkdir(DEVELOP_EGG)
+
+def to_test(project, packages):
+    if 'test' in packages[0].extras:
         return project + ' [test]'
     return project
 
@@ -76,40 +80,39 @@
 kgs_ws = WorkingSet(kgs_env)
 trunk_env = Environment([DEVELOP_EGG,])
 
-for project in wanted:
+for project in projects:
     print project
     if not os.path.isdir(project):
         os.system('svn co %s/%s/trunk %s' % (ZOPE3_SVN, project, project))
 
+    script_name = project.replace('.', '-')
+
+    # Released version
     packages = kgs_env[project]
-    kgs_need_test = False
     if not len(packages):
-        easy_install.install(project, EGG_CACHE, newest=NEWEST, working_set=kgs_ws)
+        easy_install.install(project, EGG_CACHE, working_set=kgs_ws)
         packages = kgs_env[project]
-    kgs_need_test = 'test' in packages[0].extras
 
+    kgs_conf.write("""
+[test-%s]
+recipe = zc.recipe.testrunner
+eggs = %s
+""" % (script_name, to_test(project, packages)))
+
+    # Trunk version
     packages = trunk_env[project]
-    trunk_need_test = False
     if not len(packages):
-        easy_install.develop(os.path.abspath(project), os.path.abspath(DEVELOP_EGG))
+        easy_install.develop(os.path.abspath(project),
+                             os.path.abspath(DEVELOP_EGG))
         # Rescan evrything, trunk_env.scan don't seems to work
         trunk_env = Environment([DEVELOP_EGG,])
         packages = trunk_env[project]
 
-    trunk_need_test = 'test' in packages[0].extras
-
-    script_name = project.replace('.', '-')
-
-    kgs_conf.write("""
-[test-%s]
-recipe = zc.recipe.testrunner
-eggs = %s
-""" % (script_name, to_test(project, kgs_need_test)))
     trunk_conf.write("""
 [test-%s]
 recipe = zc.recipe.testrunner
 eggs = %s
-""" % (script_name, to_test(project, trunk_need_test)))
+""" % (script_name, to_test(project, packages)))
 
 
 # Clean develop-eggs, otherwise if you choose KGS you still have trunk



More information about the Checkins mailing list