Commit 0681728b authored by Xavier Thompson's avatar Xavier Thompson

[feat] zc.recipe.egg: Reinstall when setup-eggs versions change

Trigger uninstall + install of eggs installed with zc.recipe.egg:custom
or :develop when pinned versions of setup-eggs have changed. To achieve
this the versions of setup-eggs are included in the section: this makes
them part of its signature so that when they change, buildout will call
`uninstall` and `install` for this section instead of just `update`.

Unlike other zc.recipe.egg entry points, :custom stores the path of the
installed egg; thus `uninstall` will remove it fully, leaving `install`
to reinstall it cleanly from scrach.

In the case of :develop, `uninstall` matters little as only the path of
the installed `.egg-link` is stored. Instead `install` must be fixed to
actually rebuild the egg in-place in the source directory and `develop`
should do nothing.

The main issue lies in `zc.buildout.easy_install.develop`: depending on
the build process, it may leave build artifacts in the source directory
that cause future runs to do nothing.
parent b2a0e91c
......@@ -61,6 +61,16 @@ class Base:
self.newest = buildout['buildout'].get('newest') == 'true'
self.setup_eggs = setup_eggs = [
r.strip()
for r in options.get('setup-eggs', '').split('\n')
if r.strip()]
# Put setup_eggs versions in section to include them in signature,
# so that changing them will trigger uninstall + install.
options['_v'] = ' '.join(
buildout.versions.get(egg, 'none') for egg in setup_eggs)
def install(self):
......@@ -96,10 +106,7 @@ class Base:
def _install_setup_eggs(self):
options = self.options
setup_eggs = [
r.strip()
for r in options.get('setup-eggs', '').split('\n')
if r.strip()]
setup_eggs = self.setup_eggs
if setup_eggs:
ws = zc.buildout.easy_install.install(
setup_eggs, options['_e'],
......@@ -159,6 +166,11 @@ class Develop(Base):
return zc.buildout.easy_install.develop(
options['setup'], options['_d'], self.build_ext)
def update(self):
# If any option changes or the source directory is reinstalled
# or the .egg-link is deleted, install will be called instead.
pass
def build_ext(buildout, options):
result = {}
......
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