summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2022-08-01 08:48:07 -0700
committerGitHub <noreply@github.com>2022-08-01 15:48:07 +0000
commit90dbfea895454a22604832ddf8e6e6b8169489cf (patch)
treeb1f3c2f3e7dcdb975a26a42acef24beef69f5c79 /var
parentae3c0399083f25a20efb9b300aa0caf99f3dc12b (diff)
downloadspack-90dbfea895454a22604832ddf8e6e6b8169489cf.tar.gz
spack-90dbfea895454a22604832ddf8e6e6b8169489cf.tar.bz2
spack-90dbfea895454a22604832ddf8e6e6b8169489cf.tar.xz
spack-90dbfea895454a22604832ddf8e6e6b8169489cf.zip
python: fix clingo bootstrapping on Apple M1/M2 (#31792)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/clingo/package.py4
-rw-r--r--var/spack/repos/builtin/packages/python/package.py13
2 files changed, 10 insertions, 7 deletions
diff --git a/var/spack/repos/builtin/packages/clingo/package.py b/var/spack/repos/builtin/packages/clingo/package.py
index 27dd3473e5..bef3e146cb 100644
--- a/var/spack/repos/builtin/packages/clingo/package.py
+++ b/var/spack/repos/builtin/packages/clingo/package.py
@@ -74,8 +74,8 @@ class Clingo(CMakePackage):
"""
python = self.spec["python"]
return [
- self.define("Python_EXECUTABLE", str(python.command)),
- self.define("Python_INCLUDE_DIR", python.package.config_vars["include"]),
+ self.define("Python_EXECUTABLE", python.command),
+ self.define("Python_INCLUDE_DIR", python.headers.directories[0]),
]
@property
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index 79dc35fafc..9f3ffa92d9 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -961,6 +961,7 @@ config.update(get_paths())
# get_config_vars
"BINDIR": self.prefix.bin,
"CC": "cc",
+ "CONFINCLUDEPY": self.prefix.include.join("python{}").format(version),
"CXX": "c++",
"INCLUDEPY": self.prefix.include.join("python{}").format(version),
"LIBDEST": self.prefix.lib.join("python{}").format(version),
@@ -1098,15 +1099,17 @@ config.update(get_paths())
@property
def headers(self):
- directory = self.config_vars["include"]
+ # Location where pyconfig.h is _supposed_ to be
config_h = self.config_vars["config_h_filename"]
-
if os.path.exists(config_h):
headers = HeaderList(config_h)
else:
- headers = find_headers("pyconfig", directory)
- if headers:
- config_h = headers[0]
+ # If not, one of these config vars should contain the right directory
+ for var in ["INCLUDEPY", "CONFINCLUDEPY"]:
+ headers = find_headers("pyconfig", self.config_vars[var])
+ if headers:
+ config_h = headers[0]
+ break
else:
msg = "Unable to locate {} headers in {}"
raise spack.error.NoHeadersError(msg.format(self.name, directory))