Commit 418893a9 authored by Jim Fulton's avatar Jim Fulton

Bugs Fixed

----------

- Uninstall recipes weren't loaded correctly in cases where
  no parts in the (new) configuration used the recipe egg.
parent ac702c5f
......@@ -20,7 +20,7 @@ priorities include:
Change History
**************
1.0.0b15 (2006-12-07)
1.0.0b16 (2006-12-07)
=====================
Feature Changes
......@@ -39,6 +39,15 @@ Bugs Fixed
those parts are supposed to be installed, but the buildout was also
building parts that those parts depended on.
1.0.0b15 (2006-12-06)
=====================
Bugs Fixed
----------
- Uninstall recipes weren't loaded correctly in cases where
no parts in the (new) configuration used the recipe egg.
1.0.0b14 (2006-12-05)
=====================
......
......@@ -7,7 +7,7 @@ def read(*rnames):
name = "zc.buildout"
setup(
name = name,
version = "1.0.0b14",
version = "1.0.0b15",
author = "Jim Fulton",
author_email = "jim@zope.com",
description = "System for managing development buildouts",
......
......@@ -256,12 +256,11 @@ class Buildout(UserDict.DictMixin):
# run uinstall recipe
recipe, entry = _recipe(installed_part_options[part])
try:
uninstaller = pkg_resources.load_entry_point(
recipe, 'zc.buildout.uninstall', entry)
uninstaller = _install_and_load(
recipe, 'zc.buildout.uninstall', entry, self)
self._logger.info('Running uninstall recipe')
uninstaller(part, installed_part_options[part])
except (ImportError, pkg_resources.DistributionNotFound):
# no uninstall recipe registered
except (ImportError, pkg_resources.DistributionNotFound), v:
pass
# remove created files and directories
......@@ -624,6 +623,41 @@ class Buildout(UserDict.DictMixin):
def __iter__(self):
return iter(self._raw)
def _install_and_load(spec, group, entry, buildout):
try:
req = pkg_resources.Requirement.parse(spec)
buildout_options = buildout['buildout']
if pkg_resources.working_set.find(req) is None:
if buildout_options['offline'] == 'true':
dest = None
path = [buildout_options['develop-eggs-directory'],
buildout_options['eggs-directory'],
]
else:
dest = buildout_options['eggs-directory']
path = [buildout_options['develop-eggs-directory']]
zc.buildout.easy_install.install(
[spec], dest,
links=buildout._links,
index=buildout_options.get('index'),
path=path,
working_set=pkg_resources.working_set,
)
return pkg_resources.load_entry_point(
req.project_name, group, entry)
except Exception, v:
buildout._logger.log(
1,
"Could't load %s entry point %s\nfrom %s:\n%s.",
group, entry, spec, v)
raise
class Options(UserDict.DictMixin):
def __init__(self, buildout, section, data):
......@@ -642,29 +676,8 @@ class Options(UserDict.DictMixin):
return
reqs, entry = _recipe(self._data)
req = pkg_resources.Requirement.parse(reqs)
buildout = self.buildout
if pkg_resources.working_set.find(req) is None:
offline = buildout['buildout']['offline'] == 'true'
if offline:
dest = None
path = [buildout['buildout']['develop-eggs-directory'],
buildout['buildout']['eggs-directory'],
]
else:
dest = buildout['buildout']['eggs-directory']
path = [buildout['buildout']['develop-eggs-directory']]
zc.buildout.easy_install.install(
[reqs], dest,
links=buildout._links,
index=buildout['buildout'].get('index'),
path=path,
working_set=pkg_resources.working_set,
)
recipe_class = pkg_resources.load_entry_point(
req.project_name, 'zc.buildout', entry)
recipe_class = _install_and_load(reqs, 'zc.buildout', entry, buildout)
self.recipe = recipe_class(buildout, self.name, self)
buildout._parts.append(self.name)
......
......@@ -754,7 +754,79 @@ existing setup.cfg:
define = X,Y
"""
def uninstall_recipes_used_for_removal():
"""
Uninstall recipes need to be called when a part is removed too:
>>> mkdir("recipes")
>>> write("recipes", "setup.py",
... '''
... from setuptools import setup
... setup(name='recipes',
... entry_points={
... 'zc.buildout': ["demo=demo:Install"],
... 'zc.buildout.uninstall': ["demo=demo:uninstall"],
... })
... ''')
>>> write("recipes", "demo.py",
... '''
... class Install:
... def __init__(*args): pass
... def install(self):
... print 'installing'
... return ()
... def uninstall(name, options): print 'uninstalling'
... ''')
>>> write('buildout.cfg', '''
... [buildout]
... develop = recipes
... parts = demo
... [demo]
... recipe = recipes:demo
... ''')
>>> print system(join('bin', 'buildout')),
buildout: Develop: /tmp/tmpnTSVbq/_TEST_/sample-buildout/recipes
buildout: Installing demo
installing
>>> write('buildout.cfg', '''
... [buildout]
... develop = recipes
... parts = demo
... [demo]
... recipe = recipes:demo
... x = 1
... ''')
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling demo
buildout: Running uninstall recipe
uninstalling
buildout: Installing demo
installing
>>> write('buildout.cfg', '''
... [buildout]
... develop = recipes
... parts =
... ''')
>>> print system(join('bin', 'buildout')),
buildout: Develop: /sample-buildout/recipes
buildout: Uninstalling demo
buildout: Running uninstall recipe
uninstalling
"""
######################################################################
def create_sample_eggs(test, executable=sys.executable):
write = test.globs['write']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment