python312Packages.scikit-build: fix build with python3.12
This commit is contained in:
parent
36ea1c32d7
commit
299ead3fe5
2 changed files with 46 additions and 0 deletions
|
@ -34,6 +34,12 @@ buildPythonPackage rec {
|
|||
hash = "sha256-tRpRo2s3xCZQmUtQR5EvWbIuMhCyPjIfKHYR+e9uXJ0=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# https://github.com/scikit-build/scikit-build/pull/1032
|
||||
# https://github.com/scikit-build/scikit-build/issues/1047
|
||||
./python312-compatibility.patch
|
||||
];
|
||||
|
||||
# This line in the filterwarnings section of the pytest configuration leads to this error:
|
||||
# E UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the `distutils` module in `sys.modules`. This may lead to undesirable behaviors or errors. To avoid these issues, avoid using distutils directly, ensure that setuptools is installed in the traditional way (e.g. not an editable install), and/or make sure that setuptools is always imported before distutils.
|
||||
postPatch = ''
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
diff --git a/skbuild/resources/cmake/FindPythonExtensions.cmake b/skbuild/resources/cmake/FindPythonExtensions.cmake
|
||||
index 59b30c2..62298d5 100644
|
||||
--- a/skbuild/resources/cmake/FindPythonExtensions.cmake
|
||||
+++ b/skbuild/resources/cmake/FindPythonExtensions.cmake
|
||||
@@ -254,19 +254,23 @@ endif()
|
||||
include(targetLinkLibrariesWithDynamicLookup)
|
||||
|
||||
set(_command "
|
||||
-import distutils.sysconfig
|
||||
+import sys
|
||||
+
|
||||
+if sys.version_info >= (3,10):
|
||||
+ import sysconfig
|
||||
+else:
|
||||
+ from distutils import sysconfig
|
||||
import itertools
|
||||
import os
|
||||
import os.path
|
||||
import site
|
||||
-import sys
|
||||
|
||||
result = None
|
||||
rel_result = None
|
||||
candidate_lists = []
|
||||
|
||||
try:
|
||||
- candidate_lists.append((distutils.sysconfig.get_python_lib(),))
|
||||
+ candidate_lists.append((sysconfig.get_python_lib(),))
|
||||
except AttributeError: pass
|
||||
|
||||
try:
|
||||
@@ -293,7 +297,7 @@ sys.stdout.write(\";\".join((
|
||||
sys.prefix,
|
||||
result,
|
||||
rel_result,
|
||||
- distutils.sysconfig.get_config_var('EXT_SUFFIX')
|
||||
+ sysconfig.get_config_var('EXT_SUFFIX')
|
||||
)))
|
||||
")
|
||||
|
Loading…
Reference in a new issue