[Checkins] SVN: z3c.recipe.compattest/trunk/ implemented use_svn option to use trunk checkouts
Wolfgang Schnerring
wosc at wosc.de
Wed Jan 28 09:03:15 EST 2009
Log message for revision 95314:
implemented use_svn option to use trunk checkouts
Changed:
U z3c.recipe.compattest/trunk/CHANGES.txt
U z3c.recipe.compattest/trunk/buildout.cfg
U z3c.recipe.compattest/trunk/setup.py
U z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/README.txt
U z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/recipe.py
U z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/testing.py
-=-
Modified: z3c.recipe.compattest/trunk/CHANGES.txt
===================================================================
--- z3c.recipe.compattest/trunk/CHANGES.txt 2009-01-28 13:55:39 UTC (rev 95313)
+++ z3c.recipe.compattest/trunk/CHANGES.txt 2009-01-28 14:03:14 UTC (rev 95314)
@@ -5,7 +5,8 @@
0.2 (unreleased)
================
-- ...
+- Implemented use_svn option to use SVN trunk checkouts instead of released
+ versions.
0.1 (2009-01-28)
================
Modified: z3c.recipe.compattest/trunk/buildout.cfg
===================================================================
--- z3c.recipe.compattest/trunk/buildout.cfg 2009-01-28 13:55:39 UTC (rev 95313)
+++ z3c.recipe.compattest/trunk/buildout.cfg 2009-01-28 14:03:14 UTC (rev 95314)
@@ -1,6 +1,6 @@
[buildout]
develop = .
-parts = test compattest
+parts = test compattest compattest-trunk
[test]
recipe = zc.recipe.testrunner
@@ -10,3 +10,9 @@
[compattest]
recipe = z3c.recipe.compattest
include = z3c.recipe.compattest
+
+[compattest-trunk]
+recipe = z3c.recipe.compattest
+include = zope.dottedname
+use_trunk = true
+
Modified: z3c.recipe.compattest/trunk/setup.py
===================================================================
--- z3c.recipe.compattest/trunk/setup.py 2009-01-28 13:55:39 UTC (rev 95313)
+++ z3c.recipe.compattest/trunk/setup.py 2009-01-28 14:03:14 UTC (rev 95314)
@@ -25,6 +25,7 @@
package_dir = {'': 'src'},
namespace_packages=['z3c', 'z3c.recipe'],
install_requires=[
+ 'infrae.subversion',
'setuptools',
'zc.buildout',
'zc.recipe.testrunner',
Modified: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/README.txt
===================================================================
--- z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/README.txt 2009-01-28 13:55:39 UTC (rev 95313)
+++ z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/README.txt 2009-01-28 14:03:14 UTC (rev 95314)
@@ -22,6 +22,9 @@
details),
- ``script``: the name of the runner script (default: test-compat).
+- ``use_svn``: use SVN checkouts instead of releases (see below)
+- ``svn_directory``: directory to place checkouts in (default: parts/<partname>)
+
>>> cd(sample_buildout)
>>> write('buildout.cfg', """
... [buildout]
@@ -36,8 +39,8 @@
include/exclude values, about 150 packages will be included, so be aware
that running the buildout will take some time.
->>> system(buildout).find('Installing compattest') != -1
-True
+>>> print system(buildout)
+Couldn't...Installing compattest...
Details
=======
@@ -48,8 +51,8 @@
>>> ls('bin')
- buildout
- compattest-z3c.recipe.compattest
-- test-compat
->>> cat('bin', 'test-compat')
+- test-compattest
+>>> cat('bin', 'test-compattest')
#!/...python...
...main(...compattest-z3c.recipe.compattest...
@@ -61,3 +64,47 @@
>>> cat('bin', 'compattest-z3c.recipe.compattest')
#!/...python...
...zope.dottedname...
+
+Using SVN checkouts
+===================
+
+When you set ``use_svn`` to true, the test runners will not refer to released
+eggs, but rather use development-egg links to SVN checkouts of the trunks of
+each package (the checkouts are placed in ``svn_directory``).
+
+Note: Even though the generated testrunners will use development-egg links, this
+does not change the develop-eggs for your buildout itself. We check that before
+the installation of the recipe, there's just the single develop-egg link of the
+package we're working on:
+
+>>> ls('develop-eggs')
+- z3c.recipe.compattest.egg-link
+
+>>> write('buildout.cfg', """
+... [buildout]
+... parts = compattest-trunk
+...
+... [compattest-trunk]
+... recipe = z3c.recipe.compattest
+... include = zope.dottedname
+... use_svn = true
+... """)
+>>> ignore = system(buildout)
+
+The checkouts are placed in the ``parts/`` folder by default, but you can
+override this by setting ``svn_directory`` -- so you can share checkouts
+between several buildouts, for example.
+
+>>> ls('parts/compattest-trunk')
+d zope.dottedname
+
+The testrunner uses the checked out version of zope.dottedname:
+
+>>> cat('bin', 'compattest-trunk-zope.dottedname')
+#!/...python...
+...parts/compattest-trunk/zope.dottedname/src...
+
+But no additional develop-egg links are present:
+
+>>> ls('develop-eggs')
+- z3c.recipe.compattest.egg-link
Modified: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/recipe.py
===================================================================
--- z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/recipe.py 2009-01-28 13:55:39 UTC (rev 95313)
+++ z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/recipe.py 2009-01-28 14:03:14 UTC (rev 95314)
@@ -1,3 +1,4 @@
+import infrae.subversion
import os
import pkg_resources
import popen2
@@ -52,19 +53,37 @@
self.svn_url = self.options.get('svn_url',
'svn://svn.zope.org/repos/main/')
+ if self.svn_url[-1] != '/':
+ self.svn_url += '/'
self.exclude = string2list(self.options.get('exclude', ''), EXCLUDE)
self.include = string2list(self.options.get('include', ''), INCLUDE)
- self.script = self.options.get('script', 'test-compat')
+ self.script = self.options.get('script', 'test-%s' % self.name)
self.wanted_packages = self._wanted_packages()
+ self.use_svn = self.options.get('use_svn', False)
+ self.svn_directory = self.options.get(
+ 'svn_directory', os.path.join(
+ self.buildout['buildout']['parts-directory'], self.name))
+
def install(self):
+ if self.use_svn:
+ if not os.path.exists(self.svn_directory):
+ os.mkdir(self.svn_directory)
return self.update()
def update(self):
installed = []
+
+ if self.use_svn:
+ self._checkout_or_update_trunks()
+
installed.extend(self._install_testrunners())
installed.extend(self._install_run_script())
+
+ if self.use_svn:
+ self._remove_develop_eggs()
+
return installed
def _install_testrunners(self):
@@ -119,3 +138,26 @@
eggs = zc.recipe.egg.Egg(self.buildout, self.name, dict(eggs=package))
_, ws = eggs.working_set()
return ws
+
+ def _checkout_or_update_trunks(self):
+ self.installed_develop_eggs = []
+
+ checkout_list = []
+ for package in self.wanted_packages:
+ working_copy = os.path.join(self.svn_directory, package)
+ checkout_list.append('%s%s/trunk %s' % (self.svn_url, package,
+ package))
+ self.installed_develop_eggs.append(package)
+
+ infrae.subversion.Recipe(self.buildout, self.name, dict(
+ urls='\n'.join(checkout_list),
+ location=self.svn_directory,
+ as_eggs='true',
+ )).update()
+
+ def _remove_develop_eggs(self):
+ eggdir = self.buildout['buildout']['develop-eggs-directory']
+ for egg_link in os.listdir(eggdir):
+ egg, _ = os.path.splitext(egg_link)
+ if egg in self.installed_develop_eggs:
+ os.unlink(os.path.join(eggdir, egg_link))
Modified: z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/testing.py
===================================================================
--- z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/testing.py 2009-01-28 13:55:39 UTC (rev 95313)
+++ z3c.recipe.compattest/trunk/src/z3c/recipe/compattest/testing.py 2009-01-28 14:03:14 UTC (rev 95314)
@@ -15,9 +15,10 @@
zc.buildout.testing.install('zope.testing', test)
zc.buildout.testing.install('zope.interface', test)
+ zc.buildout.testing.install('infrae.subversion', test)
+ zc.buildout.testing.install('py', test)
zc.buildout.testing.install('zope.dottedname', test)
-
def tearDown(test):
zc.buildout.testing.buildoutTearDown(test)
More information about the Checkins
mailing list