Test bootstrapping in a workflow (#25138)

Add a workflow to test bootstrapping clingo on 
different platforms so that we can detect changes 
that break it.

Compute `site_packages_dir` in `bootstrap.py` as it was
before #24095, until we figure a better way to override
that attribute.
This commit is contained in:
Massimiliano Culpo
2021-08-03 16:53:40 +02:00
committed by GitHub
parent 15bc4faf2d
commit 0026d60b60
3 changed files with 135 additions and 9 deletions

View File

@@ -92,15 +92,19 @@ def make_module_available(module, spec=None, install=False):
installed_specs = spack.store.db.query(spec, installed=True)
for ispec in installed_specs:
# TODO: make sure run-environment is appropriate
module_path = ispec['python'].package.get_python_lib(prefix=ispec.prefix)
lib_spd = ispec['python'].package.default_site_packages_dir
lib64_spd = lib_spd.replace('lib/', 'lib64/')
module_paths = [
os.path.join(ispec.prefix, lib_spd),
os.path.join(ispec.prefix, lib64_spd)
]
try:
sys.path.append(module_path)
sys.path.extend(module_paths)
__import__(module)
return
except ImportError:
tty.warn("Spec %s did not provide module %s" % (ispec, module))
sys.path = sys.path[:-1]
sys.path = sys.path[:-2]
def _raise_error(module_name, module_spec):
error_msg = 'cannot import module "{0}"'.format(module_name)
@@ -117,13 +121,18 @@ def _raise_error(module_name, module_spec):
spec.concretize()
spec.package.do_install()
module_path = spec['python'].package.get_python_lib(prefix=spec.prefix)
lib_spd = spec['python'].package.default_site_packages_dir
lib64_spd = lib_spd.replace('lib/', 'lib64/')
module_paths = [
os.path.join(spec.prefix, lib_spd),
os.path.join(spec.prefix, lib64_spd)
]
try:
sys.path.append(module_path)
sys.path.extend(module_paths)
__import__(module)
return
except ImportError:
sys.path = sys.path[:-1]
sys.path = sys.path[:-2]
_raise_error(module, spec)