clingo ^pyhton@3.12: revisit distutils fix (#40844)

This commit is contained in:
Harmen Stoppels 2023-11-02 16:48:21 +01:00 committed by GitHub
parent bb64b22066
commit 6930176ac6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 15 deletions

View file

@ -72,7 +72,7 @@ class Clingo(CMakePackage):
# 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")
patch("setuptools-2.patch")
depends_on("py-setuptools", type="build")
def patch(self):

View file

@ -0,0 +1,8 @@
diff --git a/cmake/python-site.py b/cmake/python-site.py
--- a/cmake/python-site.py
+++ b/cmake/python-site.py
@@ -1,3 +1,4 @@
+import setuptools # makes import distutils work
from distutils.sysconfig import get_python_lib, get_config_vars
import sys
if sys.argv[1] == "prefix":

View file

@ -1,14 +0,0 @@
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))