From e47f0d486c91d4b9687cbc98ea83442f3b8c21c1 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Mon, 6 Sep 2021 11:11:47 +0200 Subject: Account for bootstrapping from sources niche case This modification accounts for: 1. Bootstrapping from sources using system, non-standard Python 2. Using later an ABI compatible standard Python interpreter --- lib/spack/spack/bootstrap.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/spack/spack/bootstrap.py b/lib/spack/spack/bootstrap.py index fe4e0022e6..34e5151b78 100644 --- a/lib/spack/spack/bootstrap.py +++ b/lib/spack/spack/bootstrap.py @@ -122,7 +122,8 @@ def _fix_ext_suffix(candidate_spec): _suffix_to_be_checked = { 'ppc64le': { 'glob': '*.cpython-*-powerpc64le-linux-gnu.so', - 're': r'.cpython-[\w]*-powerpc64le-linux-gnu.so' + 're': r'.cpython-[\w]*-powerpc64le-linux-gnu.so', + 'fmt': r'{module}.cpython-{major}{minor}m-powerpc64le-linux-gnu.so' } } @@ -143,16 +144,31 @@ def _fix_ext_suffix(candidate_spec): # If we are here it means the current interpreter expects different names # than pristine CPython. So: - # 1. Find what we have - # 2. Compute what we want - # 3. Create symbolic links if they're not there already - extensions_on_disk = fs.find(candidate_spec.prefix, expected['glob']) - link_names = [re.sub(expected['re'], ext_suffix, s) for s in extensions_on_disk] - for file_name, link_name in zip(extensions_on_disk, link_names): + # 1. Find what we have installed + # 2. Create symbolic links for the other names, it they're not there already + + # Check if standard names are installed and if we have to create + # link for this interpreter + standard_extensions = fs.find(candidate_spec.prefix, expected['glob']) + link_names = [re.sub(expected['re'], ext_suffix, s) for s in standard_extensions] + for file_name, link_name in zip(standard_extensions, link_names): if os.path.exists(link_name): continue os.symlink(file_name, link_name) + # Check if this interpreter installed something and we have to create + # links for a standard CPython interpreter + non_standard_extensions = fs.find(candidate_spec.prefix, '*' + ext_suffix) + for abs_path in non_standard_extensions: + directory, filename = os.path.split(abs_path) + module = filename.split('.')[0] + link_name = os.path.join(directory, expected['fmt'].format( + module=module, major=sys.version_info[0], minor=sys.version_info[1]) + ) + if os.path.exists(link_name): + continue + os.symlink(abs_path, link_name) + @_bootstrapper(type='buildcache') class _BuildcacheBootstrapper(object): -- cgit v1.2.3-70-g09d2