Skip to content

Commit

Permalink
removed the "check out packages from subversion" feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
wosc committed Sep 30, 2009
1 parent a5c582a commit 4b91a8b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 125 deletions.
7 changes: 4 additions & 3 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ CHANGES
0.11 (unreleased)
=================

- Nothing changed yet.

- Removed the "check out packages from subversion" feature.
If you require such functionality, mr.developer
<http://pypi.python.org/pypi/mr.developer> provides this much more
comprehensively (and for multiple version control systems, too) .

0.10 (2009-09-28)
=================
Expand All @@ -28,7 +30,6 @@ CHANGES
- Changed the default master script name to the part name. (Don't add
a "test-" prefix any more.)


0.7 (2009-08-13)
================

Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
package_dir = {'': 'src'},
namespace_packages=['z3c', 'z3c.recipe'],
install_requires=[
'infrae.subversion>=1.4.5',
'setuptools',
'zc.buildout',
'zc.recipe.testrunner',
Expand Down
53 changes: 0 additions & 53 deletions src/z3c/recipe/compattest/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ No further configuration is required, but you can set the following options:
(default: empty)
- ``script``: the name of the runner script (defaults to the part name)

- ``svn_url``: SVN repository to search for packages instead of using releases
(see below)
- ``svn_directory``: directory to place checkouts in (default: parts/<partname>)

>>> cd(sample_buildout)
>>> write('buildout.cfg', """
... [buildout]
Expand Down Expand Up @@ -60,55 +56,6 @@ picked up:
#!...python...
...zope.dottedname...

Using SVN checkouts
===================

When you set an ``svn_url``, 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
...
... [kgs]
... packages = z3c.recipe.compattest zope.dottedname
...
... [compattest-trunk]
... recipe = z3c.recipe.compattest
... include = ${kgs:packages}
... svn_url = svn://svn.zope.org/repos/main/
... """)
>>> 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.

Note that for packages that already exist as develop eggs (in our example,
z3c.recipe.compattest), no checkout is performed.

>>> 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

Passing options to the test runners
===================================
Expand Down
68 changes: 3 additions & 65 deletions src/z3c/recipe/compattest/recipe.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import infrae.subversion
import os
import pkg_resources
import re
Expand Down Expand Up @@ -31,13 +30,6 @@ def __init__(self, buildout, name, options):

self.script = self.options.get('script', self.name)

self.svn_url = self.options.get('svn_url', None)
if self.svn_url and self.svn_url[-1] != '/':
self.svn_url += '/'
self.svn_directory = self.options.get(
'svn_directory', os.path.join(
self.buildout['buildout']['parts-directory'], self.name))

# gather options to be passed to the underlying testrunner
self.testrunner_options = {}
for opt in self.options:
Expand All @@ -46,42 +38,20 @@ def __init__(self, buildout, name, options):
self.testrunner_options[runner_opt] = self.options[opt]

def install(self):
if self.svn_url:
if not os.path.exists(self.svn_directory):
os.mkdir(self.svn_directory)
return self.update()

def update(self):
installed = []

if self.svn_url:
zc.buildout.easy_install.distribution_cache = {}
self._install_checkouts()

installed.extend(self._install_testrunners())
installed.extend(self._install_run_script())

if self.svn_url:
self._remove_develop_eggs()
zc.buildout.easy_install.distribution_cache = {}

return installed

def _install_testrunners(self):
installed = []
for package in self.wanted_packages:
try:
ws = self._working_set(package)
package_ = ws.find(pkg_resources.Requirement.parse(package))
extras = '[' + ','.join(package_.extras) + ']'
except zc.buildout.easy_install.MissingDistribution, e:
if e.data[0].project_name == package and not self.svn_url:
# This package has a project in subversion but no
# release (yet). We'll ignore it for now.
print "No release found for %s. Ignoring." % package
self.wanted_packages.remove(package)
continue
raise
ws = self._working_set(package)
package_ = ws.find(pkg_resources.Requirement.parse(package))
extras = '[' + ','.join(package_.extras) + ']'

options = self.testrunner_options.copy()
options['eggs'] = package + extras
Expand Down Expand Up @@ -117,35 +87,3 @@ def _working_set(self, package):
eggs = zc.recipe.egg.Egg(self.buildout, self.name, dict(eggs=package))
_, ws = eggs.working_set()
return ws

def _install_checkouts(self):
self.develop_eggs = []

eggdir = self.buildout['buildout']['develop-eggs-directory']
egg_links = os.listdir(eggdir)
installed_develop_eggs = [os.path.splitext(f)[0] for f in egg_links]

checkout_list = []
for package in self.wanted_packages:
if package in installed_develop_eggs:
continue
working_copy = os.path.join(self.svn_directory, package)
checkout_list.append('%s%s/trunk %s' % (self.svn_url, package,
package))
self.develop_eggs.append(package)

recipe = infrae.subversion.Recipe(self.buildout, self.name, dict(
urls='\n'.join(checkout_list),
location=self.svn_directory,
as_eggs='true',
no_warnings='true',
))
recipe.newest = True
recipe.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.develop_eggs:
os.unlink(os.path.join(eggdir, egg_link))
3 changes: 0 additions & 3 deletions src/z3c/recipe/compattest/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ def setUp(test):
zc.buildout.testing.install('zope.testing', test)
zc.buildout.testing.install('zope.interface', test)
zc.buildout.testing.install('zope.exceptions', test)

zc.buildout.testing.install('infrae.subversion', test)
zc.buildout.testing.install('py', test)
zc.buildout.testing.install('zope.dottedname', test)

def tearDown(test):
Expand Down

0 comments on commit 4b91a8b

Please sign in to comment.