diff options
-rw-r--r-- | var/spack/repos/builtin/packages/miniforge3/package.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/miniforge3/package.py b/var/spack/repos/builtin/packages/miniforge3/package.py index f690742aca..8f5d3c05e2 100644 --- a/var/spack/repos/builtin/packages/miniforge3/package.py +++ b/var/spack/repos/builtin/packages/miniforge3/package.py @@ -56,6 +56,21 @@ class Miniforge3(Package): bash = which("bash") bash(script, "-b", "-f", "-p", self.prefix) + @run_after("install") + def patch_sbang(self): + # Conda replaces the full path to the Python executable with `/usr/bin/env python` + # if the full path exceeds 127 characters. This does however break `conda deactivate` + # because the wrong Python interpreter is used after activating an environment. + # The 127 character limit is not relevant in Spack as Spack will automatically + # use the `sbang` script to deal with the overly long sbang line. + filter_file( + r"#!/usr/bin/env python", rf"#!{self.prefix.bin.python}", self.prefix.bin.conda + ) + if "+mamba" in self.spec: + filter_file( + r"#!/usr/bin/env python", rf"#!{self.prefix.bin.python}", self.prefix.bin.mamba + ) + def setup_run_environment(self, env): filename = self.prefix.etc.join("profile.d").join("conda.sh") env.extend(EnvironmentModifications.from_sourcing_file(filename)) |