Commit 7cc156a7 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 fa83cc71
......@@ -673,6 +673,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']]
......@@ -681,7 +689,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'),
......@@ -1239,8 +1247,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'),
......@@ -1250,7 +1267,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