diff options
author | John W. Parent <45471568+johnwparent@users.noreply.github.com> | 2024-08-24 03:34:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-24 09:34:24 +0200 |
commit | 1f1021a47fe389e1a6108acb14602fe86e23b3bd (patch) | |
tree | e2934bc699e7ebbdab8c1c1f16a3252e13024427 | |
parent | 296e5308a7d2cde1226e179c7d695b45ff287c58 (diff) | |
download | spack-1f1021a47fe389e1a6108acb14602fe86e23b3bd.tar.gz spack-1f1021a47fe389e1a6108acb14602fe86e23b3bd.tar.bz2 spack-1f1021a47fe389e1a6108acb14602fe86e23b3bd.tar.xz spack-1f1021a47fe389e1a6108acb14602fe86e23b3bd.zip |
PythonExtension: use different bin dir on Windows (#45427)
-rw-r--r-- | lib/spack/spack/build_systems/python.py | 8 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/python-venv/package.py | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/spack/spack/build_systems/python.py b/lib/spack/spack/build_systems/python.py index 0f99fe536a..3504406253 100644 --- a/lib/spack/spack/build_systems/python.py +++ b/lib/spack/spack/build_systems/python.py @@ -17,7 +17,7 @@ import archspec import llnl.util.filesystem as fs import llnl.util.lang as lang import llnl.util.tty as tty -from llnl.util.filesystem import HeaderList, LibraryList +from llnl.util.filesystem import HeaderList, LibraryList, join_path import spack.builder import spack.config @@ -120,6 +120,12 @@ class PythonExtension(spack.package_base.PackageBase): """ return [] + @property + def bindir(self) -> str: + """Path to Python package's bindir, bin on unix like OS's Scripts on Windows""" + windows = self.spec.satisfies("platform=windows") + return join_path(self.spec.prefix, "Scripts" if windows else "bin") + 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 diff --git a/var/spack/repos/builtin/packages/python-venv/package.py b/var/spack/repos/builtin/packages/python-venv/package.py index a814f47221..390b26c198 100644 --- a/var/spack/repos/builtin/packages/python-venv/package.py +++ b/var/spack/repos/builtin/packages/python-venv/package.py @@ -93,6 +93,9 @@ class PythonVenv(Package): path = os.path.join(dependent_spec.prefix, directory) if os.path.isdir(path): env.prepend_path("PYTHONPATH", path) + dep_bin_dir = getattr(dependent_spec.package, "bindir", None) + if dep_bin_dir and os.path.isdir(dep_bin_dir): + env.prepend_path("PATH", dep_bin_dir) def setup_dependent_package(self, module, dependent_spec): """Called before python modules' install() methods.""" |