Added
Link Here
|
0 |
- |
1 |
--- python/FindPythonLibsNew.cmake.orig 2024-07-16 20:38:32 UTC |
|
|
2 |
+++ python/FindPythonLibsNew.cmake |
3 |
@@ -74,13 +74,28 @@ endif() |
4 |
# |
5 |
# The library suffix is from the config var LDVERSION sometimes, otherwise |
6 |
# VERSION. VERSION will typically be like "2.7" on unix, and "27" on windows. |
7 |
-execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" |
8 |
- "from distutils import sysconfig as s;import sys;import struct; |
9 |
+execute_process( |
10 |
+ COMMAND |
11 |
+ "${Python_EXECUTABLE}" "-c" " |
12 |
+import sys;import struct; |
13 |
+import sysconfig as s |
14 |
+USE_SYSCONFIG = sys.version_info >= (3, 10) |
15 |
+if not USE_SYSCONFIG: |
16 |
+ from distutils import sysconfig as ds |
17 |
print('.'.join(str(v) for v in sys.version_info)); |
18 |
print(sys.prefix); |
19 |
-print(s.get_python_inc(plat_specific=True)); |
20 |
-print(s.get_python_lib(plat_specific=True)); |
21 |
-print(s.get_config_var('SO')); |
22 |
+if USE_SYSCONFIG: |
23 |
+ scheme = s.get_default_scheme() |
24 |
+ if scheme == 'posix_local': |
25 |
+ # Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/ |
26 |
+ scheme = 'posix_prefix' |
27 |
+ print(s.get_path('platinclude', scheme)) |
28 |
+ print(s.get_path('platlib')) |
29 |
+ print(s.get_config_var('EXT_SUFFIX') or s.get_config_var('SO')) |
30 |
+else: |
31 |
+ print(ds.get_python_inc(plat_specific=True)); |
32 |
+ print(ds.get_python_lib(plat_specific=True)); |
33 |
+ print(ds.get_config_var('EXT_SUFFIX') or ds.get_config_var('SO')); |
34 |
print(hasattr(sys, 'gettotalrefcount')+0); |
35 |
print(struct.calcsize('@P')); |
36 |
print(s.get_config_var('LDVERSION') or s.get_config_var('VERSION')); |
37 |
@@ -196,7 +211,7 @@ find_package_message(PYTHON |
38 |
|
39 |
find_package_message(PYTHON |
40 |
"Found PythonLibs: ${PYTHON_LIBRARY}" |
41 |
- "${PYTHON_EXECUTABLE}${PYTHON_VERSION}") |
42 |
+ "${Python_EXECUTABLE}${PYTHON_VERSION}") |
43 |
|
44 |
set(PYTHONLIBS_FOUND TRUE) |
45 |
set(PythonLibsNew_FOUND TRUE) |