summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2020-01-16 15:21:14 -0600
committerGitHub <noreply@github.com>2020-01-16 15:21:14 -0600
commit7a61d1dbd1b7c16f65c03aab28619d581b28fe7c (patch)
treece4c810ce86f6a676b1011934b6f9a710a45ba2d
parent0f68ed73c611dbdd992752a1a5536339b2f6c37b (diff)
downloadspack-7a61d1dbd1b7c16f65c03aab28619d581b28fe7c.tar.gz
spack-7a61d1dbd1b7c16f65c03aab28619d581b28fe7c.tar.bz2
spack-7a61d1dbd1b7c16f65c03aab28619d581b28fe7c.tar.xz
spack-7a61d1dbd1b7c16f65c03aab28619d581b28fe7c.zip
Add include/pythonX.Y to CPATH (#14523)
-rw-r--r--var/spack/repos/builtin/packages/python/package.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index c0e2b34147..151b56bb8d 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -678,14 +678,20 @@ class Python(AutotoolsPackage):
@property
def headers(self):
- config_h = self.get_config_h_filename()
+ try:
+ config_h = self.get_config_h_filename()
+
+ if not os.path.exists(config_h):
+ includepy = self.get_config_var('INCLUDEPY')
+ msg = 'Unable to locate {0} headers in {1}'
+ raise RuntimeError(msg.format(self.name, includepy))
- if not os.path.exists(config_h):
- includepy = self.get_config_var('INCLUDEPY')
- msg = 'Unable to locate {0} headers in {1}'
- raise RuntimeError(msg.format(self.name, includepy))
+ headers = HeaderList(config_h)
+ except ProcessError:
+ headers = find_headers(
+ 'pyconfig', self.prefix.include, recursive=True)
+ config_h = headers[0]
- headers = HeaderList(config_h)
headers.directories = [os.path.dirname(config_h)]
return headers
@@ -705,6 +711,9 @@ class Python(AutotoolsPackage):
def easy_install_file(self):
return join_path(self.site_packages_dir, "easy-install.pth")
+ def setup_run_environment(self, env):
+ env.prepend_path('CPATH', os.pathsep.join(self.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."""