From d0c1b7a14e7d3107da0e6a9c81668fb2627069cd Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Thu, 19 Jan 2023 09:08:39 -0600 Subject: python: remove `CPATH` from `setup_run_environment` (#34727) Currently, the `python` package tries to set `CPATH` in `setup_run_environment()`. We no longer set `CPATH` and other destructive environment variables (like `LD_LIBRARY_PATH`) in modules, so we shouldn't do something special for Python. Also, the way `python` sets `CPATH` causes issues. Because it does a header search to find directories containing headers, if you bootstrap `mypy` or other style tools on a fresh Ubuntu image with *no* python devel headers installed, you'll get an error like this when trying to load the thing you just installed: ```console [root@980de539843d /]# spack -b load py-mypy ==> Error: Unable to locate python headers in any of these locations: /usr/include/python3.6m /usr/include/3.6 /usr/Headers ``` The headers and includes aren't needed to get `mypy` in the path or for `mypy` to work, so we're failing unnecessarily here. - [x] remove `setup_run_environment()` from `python/package.py` --- var/spack/repos/builtin/packages/python/package.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py index 8d2f216f0a..1cd5845cde 100644 --- a/var/spack/repos/builtin/packages/python/package.py +++ b/var/spack/repos/builtin/packages/python/package.py @@ -1048,9 +1048,6 @@ print(json.dumps(config)) return path.replace(prefix, "") return os.path.join("include", "python{}".format(self.version.up_to(2))) - def setup_run_environment(self, env): - env.prepend_path("CPATH", os.pathsep.join(self.spec["python"].headers.directories)) - def setup_dependent_build_environment(self, env, dependent_spec): """Set PYTHONPATH to include the site-packages directory for the extension and any other python extensions it depends on. -- cgit v1.2.3-70-g09d2