Skip to content

Commit

Permalink
make sure lib/python*/lib-dynload exists in Python installation (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
boegel committed Feb 18, 2020
1 parent 6fd0e30 commit 1ff3643
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion easybuild/easyblocks/p/python.py
Expand Up @@ -279,6 +279,21 @@ def install_step(self):
if self.cfg['ebpythonprefixes']:
write_file(os.path.join(self.installdir, self.pythonpath, 'sitecustomize.py'), SITECUSTOMIZE)

# symlink lib/python*/lib-dynload to lib64/python*/lib-dynload if it doesn't exist;
# see https://github.com/easybuilders/easybuild-easyblocks/issues/1957
lib_dynload = 'lib-dynload'
lib_dynload_path = os.path.join(self.installdir, 'lib', 'python%s' % self.pyshortver, lib_dynload)
if not os.path.exists(lib_dynload_path):
lib64_dynload_path = os.path.join(self.installdir, 'lib64', 'python%s' % self.pyshortver, lib_dynload)
if os.path.exists(lib64_dynload_path):
lib_dynload_parent = os.path.dirname(lib_dynload_path)
mkdir(lib_dynload_parent, parents=True)
cwd = change_dir(lib_dynload_parent)
# use relative path as target, to avoid hardcoding path to install directory
target_lib_dynload = os.path.join('..', '..', 'lib64', 'python%s' % self.pyshortver, lib_dynload)
symlink(target_lib_dynload, lib_dynload)
change_dir(cwd)

def sanity_check_step(self):
"""Custom sanity check for Python."""

Expand Down Expand Up @@ -313,7 +328,7 @@ def sanity_check_step(self):
pyver = 'python' + self.pyshortver
custom_paths = {
'files': [os.path.join('bin', pyver), os.path.join('lib', 'lib' + pyver + abiflags + '.' + shlib_ext)],
'dirs': [os.path.join('include', pyver + abiflags), os.path.join('lib', pyver)],
'dirs': [os.path.join('include', pyver + abiflags), os.path.join('lib', pyver, 'lib-dynload')],
}

# cleanup
Expand Down

0 comments on commit 1ff3643

Please sign in to comment.