diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2024-02-22 22:17:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-22 13:17:21 -0800 |
commit | b61d964eb89e75e9bc2d63d3a26a576bd3e96e5c (patch) | |
tree | f20f304d0c2b663b0060ad64561eecef7b9e1cf5 /lib | |
parent | 2066eda3cd2acbc9efad022812c75ebbdef77727 (diff) | |
download | spack-b61d964eb89e75e9bc2d63d3a26a576bd3e96e5c.tar.gz spack-b61d964eb89e75e9bc2d63d3a26a576bd3e96e5c.tar.bz2 spack-b61d964eb89e75e9bc2d63d3a26a576bd3e96e5c.tar.xz spack-b61d964eb89e75e9bc2d63d3a26a576bd3e96e5c.zip |
PythonPackage: check purelib for libs/headers (#42602)
* PythonPackage: check purelib for libs/headers
* Update error messages too
* Fix functools.reduce argument order
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_systems/python.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/spack/spack/build_systems/python.py b/lib/spack/spack/build_systems/python.py index f554bfef53..ec86c45633 100644 --- a/lib/spack/spack/build_systems/python.py +++ b/lib/spack/spack/build_systems/python.py @@ -2,7 +2,10 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import functools import inspect +import operator import os import re import shutil @@ -368,16 +371,20 @@ class PythonPackage(PythonExtension): # Remove py- prefix in package name name = self.spec.name[3:] - # Headers may be in either location + # Headers should only be in include or platlib, but no harm in checking purelib too include = self.prefix.join(self.spec["python"].package.include).join(name) platlib = self.prefix.join(self.spec["python"].package.platlib).join(name) - headers = fs.find_all_headers(include) + fs.find_all_headers(platlib) + purelib = self.prefix.join(self.spec["python"].package.purelib).join(name) + + find_all_headers = functools.partial(fs.find_all_headers, recursive=True) + headers_list = map(find_all_headers, [include, platlib, purelib]) + headers = functools.reduce(operator.add, headers_list) if headers: return headers - msg = "Unable to locate {} headers in {} or {}" - raise NoHeadersError(msg.format(self.spec.name, include, platlib)) + msg = "Unable to locate {} headers in {}, {}, or {}" + raise NoHeadersError(msg.format(self.spec.name, include, platlib, purelib)) @property def libs(self) -> LibraryList: @@ -386,15 +393,19 @@ class PythonPackage(PythonExtension): # Remove py- prefix in package name name = self.spec.name[3:] - root = self.prefix.join(self.spec["python"].package.platlib).join(name) + # Libraries should only be in platlib, but no harm in checking purelib too + platlib = self.prefix.join(self.spec["python"].package.platlib).join(name) + purelib = self.prefix.join(self.spec["python"].package.purelib).join(name) - libs = fs.find_all_libraries(root, recursive=True) + find_all_libraries = functools.partial(fs.find_all_libraries, recursive=True) + libs_list = map(find_all_libraries, [platlib, purelib]) + libs = functools.reduce(operator.add, libs_list) if libs: return libs - msg = "Unable to recursively locate {} libraries in {}" - raise NoLibrariesError(msg.format(self.spec.name, root)) + msg = "Unable to recursively locate {} libraries in {} or {}" + raise NoLibrariesError(msg.format(self.spec.name, platlib, purelib)) @spack.builder.builder("python_pip") |