diff options
author | Harmen Stoppels <me@harmenstoppels.nl> | 2024-05-10 10:47:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-10 10:47:37 +0200 |
commit | e7112fbc6a87eed2c602fb2e7f615710715c832f (patch) | |
tree | 3f9921f162fdf14833d9738bd7b9cd7cbc4ff369 /lib | |
parent | b79761b7eb5eb2e2d6b8174c3043524462772bf6 (diff) | |
download | spack-e7112fbc6a87eed2c602fb2e7f615710715c832f.tar.gz spack-e7112fbc6a87eed2c602fb2e7f615710715c832f.tar.bz2 spack-e7112fbc6a87eed2c602fb2e7f615710715c832f.tar.xz spack-e7112fbc6a87eed2c602fb2e7f615710715c832f.zip |
PythonExtension: fix issue where package does not extend python (#44109)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/build_systems/python.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/spack/spack/build_systems/python.py b/lib/spack/spack/build_systems/python.py index c94e2db700..0f99fe536a 100644 --- a/lib/spack/spack/build_systems/python.py +++ b/lib/spack/spack/build_systems/python.py @@ -120,12 +120,6 @@ class PythonExtension(spack.package_base.PackageBase): """ return [] - @property - def python_spec(self): - """Get python-venv if it exists or python otherwise.""" - python, *_ = self.spec.dependencies("python-venv") or self.spec.dependencies("python") - return python - def view_file_conflicts(self, view, merge_map): """Report all file conflicts, excepting special cases for python. Specifically, this does not report errors for duplicate @@ -146,8 +140,12 @@ class PythonExtension(spack.package_base.PackageBase): def add_files_to_view(self, view, merge_map, skip_if_exists=True): # Patch up shebangs if the package extends Python and we put a Python interpreter in the # view. - python = self.python_spec - if not self.extendee_spec or python.external: + if not self.extendee_spec: + return super().add_files_to_view(view, merge_map, skip_if_exists) + + python, *_ = self.spec.dependencies("python-venv") or self.spec.dependencies("python") + + if python.external: return super().add_files_to_view(view, merge_map, skip_if_exists) # We only patch shebangs in the bin directory. @@ -369,6 +367,12 @@ class PythonPackage(PythonExtension): return None @property + def python_spec(self): + """Get python-venv if it exists or python otherwise.""" + python, *_ = self.spec.dependencies("python-venv") or self.spec.dependencies("python") + return python + + @property def headers(self) -> HeaderList: """Discover header files in platlib.""" |