bind: add support for PEP-632

Signed-off-by: Sebastien Binet <binet@cern.ch>
This commit is contained in:
Sebastien Binet 2023-03-31 18:55:29 +02:00
parent b7e1c5e7f2
commit 3941218a02
1 changed files with 8 additions and 2 deletions

View File

@ -103,7 +103,13 @@ func (pc *PyConfig) AllFlags() string {
// python VM (python, python2, python3, pypy, etc...)
func GetPythonConfig(vm string) (PyConfig, error) {
code := `import sys
import distutils.sysconfig as ds
try:
import sysconfig as ds
def _get_python_inc():
return ds.get_path('include')
except ImportError:
import distutils.sysconfig as ds
_get_python_inc = ds.get_config_var
import json
import os
version=sys.version_info.major
@ -133,7 +139,7 @@ else:
print(json.dumps({
"version": sys.version_info.major,
"minor": sys.version_info.minor,
"incdir": ds.get_python_inc(),
"incdir": _get_python_inc(),
"libdir": ds.get_config_var("LIBDIR"),
"libpy": ds.get_config_var("LIBRARY"),
"shlibs": ds.get_config_var("SHLIBS"),