Python: add both lib and lib64 to PYTHONPATH (#18523)

This commit is contained in:
Adam J. Stewart 2020-10-12 19:59:20 -05:00 committed by GitHub
parent 82a224b0da
commit cb4e30b477
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -929,11 +929,14 @@ def setup_dependent_build_environment(self, env, dependent_spec):
env.prepend_path('PATH', path)
python_paths = []
for d in dependent_spec.traverse(
deptype=('build', 'run', 'test')):
for d in dependent_spec.traverse(deptype=('build', 'run', 'test')):
if d.package.extends(self.spec):
python_paths.append(join_path(d.prefix,
self.site_packages_dir))
# Python libraries may be installed in lib or lib64
# See issues #18520 and #17126
for lib in ['lib', 'lib64']:
python_paths.append(join_path(
d.prefix, lib, 'python' + str(self.version.up_to(2)),
'site-packages'))
pythonpath = ':'.join(python_paths)
env.set('PYTHONPATH', pythonpath)
@ -942,8 +945,10 @@ def setup_dependent_run_environment(self, env, dependent_spec):
# For run time environment set only the path for
# dependent_spec and prepend it to PYTHONPATH
if dependent_spec.package.extends(self.spec):
for lib in ['lib', 'lib64']:
env.prepend_path('PYTHONPATH', join_path(
dependent_spec.prefix, self.site_packages_dir))
dependent_spec.prefix, lib,
'python' + str(self.version.up_to(2)), 'site-packages'))
def setup_dependent_package(self, module, dependent_spec):
"""Called before python modules' install() methods.