summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2023-10-12 12:11:22 +0200
committerGitHub <noreply@github.com>2023-10-12 12:11:22 +0200
commit0fd2427d9b1c27c02d16075a0cc8fa2626e7ae73 (patch)
treef836916c74e5aaadb68da4bee21751eef086a1cd
parent30d29d0201ade86a12184f0ebe17ecaa3b9043e4 (diff)
downloadspack-0fd2427d9b1c27c02d16075a0cc8fa2626e7ae73.tar.gz
spack-0fd2427d9b1c27c02d16075a0cc8fa2626e7ae73.tar.bz2
spack-0fd2427d9b1c27c02d16075a0cc8fa2626e7ae73.tar.xz
spack-0fd2427d9b1c27c02d16075a0cc8fa2626e7ae73.zip
clingo: fix build with Python 3.12 (#40154)
-rw-r--r--var/spack/repos/builtin/packages/clingo/package.py7
-rw-r--r--var/spack/repos/builtin/packages/clingo/setuptools.patch14
2 files changed, 21 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/clingo/package.py b/var/spack/repos/builtin/packages/clingo/package.py
index 73797762b5..ab5fe9a043 100644
--- a/var/spack/repos/builtin/packages/clingo/package.py
+++ b/var/spack/repos/builtin/packages/clingo/package.py
@@ -42,6 +42,7 @@ class Clingo(CMakePackage):
# See https://github.com/potassco/clingo/blob/v5.5.2/INSTALL.md
depends_on("cmake@3.1:", type="build")
depends_on("cmake@3.18:", type="build", when="@5.5:")
+ depends_on("py-setuptools", when="@5.6.2:", type="build")
depends_on("doxygen", type="build", when="+docs")
@@ -68,6 +69,12 @@ class Clingo(CMakePackage):
patch("size-t.patch", when="%msvc")
patch("vs2022.patch", when="%msvc@19.30:")
+ # TODO: Simplify this after Spack 0.21 release. The old concretizer has problems with
+ # py-setuptools ^python@3.6, so we only apply the distutils -> setuptools patch for Python 3.12
+ with when("@:5.6.1 ^python@3.12:"):
+ patch("setuptools.patch")
+ depends_on("py-setuptools", type="build")
+
def patch(self):
# Doxygen is optional but can't be disabled with a -D, so patch
# it out if it's really supposed to be disabled
diff --git a/var/spack/repos/builtin/packages/clingo/setuptools.patch b/var/spack/repos/builtin/packages/clingo/setuptools.patch
new file mode 100644
index 0000000000..4a38a7e6d9
--- /dev/null
+++ b/var/spack/repos/builtin/packages/clingo/setuptools.patch
@@ -0,0 +1,14 @@
+diff --git a/cmake/python-site.py b/cmake/python-site.py
+index 1e7fc8ce..95ef827f 100644
+--- a/cmake/python-site.py
++++ b/cmake/python-site.py
+@@ -1,4 +1,7 @@
+-from distutils.sysconfig import get_python_lib, get_config_vars
++try:
++ from setuptools.sysconfig import get_python_lib, get_config_vars
++except ImportError:
++ from distutils.sysconfig import get_python_lib, get_config_vars
+ import sys
+ if sys.argv[1] == "prefix":
+ print(get_python_lib(True, False, sys.argv[2] if len(sys.argv) > 2 else None))
+