Commit 03d1e80e authored by Xavier Thompson's avatar Xavier Thompson

[feat] Add scan_any_python_version option in install

This is passed when calling `install(['zc.buildout'])` to resolve the
dists of the currently running buildout and its dependencies, as they
may not actually correspond the version of the running interpreter.

This is needed to support new slapos.rebootstrap: after compiling the
new Python interpreter, we use it to run buildout bootstrap using the
same paths to zc.buildout and dependencies as in the initial Python.
This installs the needed dists for the new Python version and creates
a new bin/buildout for the new Python interpreter.
parent 3818d40d
......@@ -279,11 +279,13 @@ class Installer(object):
allow_hosts=('*',),
check_picked=True,
allow_unknown_extras=False,
scan_any_python_version=False,
):
assert executable == sys.executable, (executable, sys.executable)
self._dest = dest if dest is None else pkg_resources.normalize_path(dest)
self._allow_hosts = allow_hosts
self._allow_unknown_extras = allow_unknown_extras
self._scan_any_python_version = scan_any_python_version
if self._install_from_cache:
if not self._download_cache:
......@@ -316,7 +318,10 @@ class Installer(object):
dest = self._dest
full_path = [] if dest is None else [dest]
full_path.extend(self._path)
return pkg_resources.Environment(full_path)
if self._scan_any_python_version:
return pkg_resources.Environment(full_path, python=None)
else:
return pkg_resources.Environment(full_path)
def _env_rescan_dest(self):
dest = self._dest
......@@ -1059,6 +1064,7 @@ def install(specs, dest,
check_picked=True,
allow_unknown_extras=False,
patch_dict=None,
scan_any_python_version=False,
):
assert executable == sys.executable, (executable, sys.executable)
assert include_site_packages is None
......@@ -1069,11 +1075,13 @@ def install(specs, dest,
newest, versions, use_dependency_links,
allow_hosts=allow_hosts,
check_picked=check_picked,
allow_unknown_extras=allow_unknown_extras)
allow_unknown_extras=allow_unknown_extras,
scan_any_python_version=scan_any_python_version)
return installer.install(specs, working_set, patch_dict=patch_dict)
buildout_and_setuptools_dists = list(install(['zc.buildout'], None,
check_picked=False))
check_picked=False,
scan_any_python_version=True))
buildout_and_setuptools_path = sorted({d.location
for d in buildout_and_setuptools_dists})
......
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