Commit 178c934b authored by Xavier Thompson's avatar Xavier Thompson

[feat] Propagate libnetworkcache installation

If slapos.libnetworkcache is importable, install it in bootstrap and
in buildout upgrade - the places where bin/buildout is (re)generated
- as though it were a dependency of zc.buildout.

This is a hack to propagate libnetworkcache as a soft dependency.
parent 53c70a07
......@@ -718,6 +718,14 @@ class Buildout(DictMixin):
self._setup_directories()
# Hack: propagate libnetworkcache soft dependency
specs = ['zc.buildout']
try:
import slapos.libnetworkcache
specs.append('slapos.libnetworkcache')
except ImportError:
pass
# Install buildout and dependent eggs following pinned versions.
dest = self['buildout']['eggs-directory']
path = [self['buildout']['develop-eggs-directory']]
......@@ -726,7 +734,7 @@ class Buildout(DictMixin):
path.append(dest)
dest = None
ws = zc.buildout.easy_install.install(
['zc.buildout'],
specs,
dest,
links=self._links,
index=self['buildout'].get('index'),
......@@ -1304,8 +1312,17 @@ class Buildout(DictMixin):
if not self.newest:
return
# Hack: propagate libnetworkcache soft dependency
# XXX just zc.buildout should suffice, then iter over projects in ws
specs = ['zc.buildout', 'setuptools', 'pip', 'wheel']
try:
import slapos.libnetworkcache
specs.append('slapos.libnetworkcache')
except ImportError:
pass
ws = zc.buildout.easy_install.install(
('zc.buildout', 'setuptools', 'pip', 'wheel'),
specs,
self['buildout']['eggs-directory'],
links = self['buildout'].get('find-links', '').split(),
index = self['buildout'].get('index'),
......@@ -1315,7 +1332,7 @@ class Buildout(DictMixin):
upgraded = []
for project in 'zc.buildout', 'setuptools', 'pip', 'wheel':
for project in specs:
req = pkg_resources.Requirement.parse(project)
dist = ws.find(req)
importlib.import_module(project)
......
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