diff --git a/build.rs b/build.rs index 76df0444..2afb5802 100644 --- a/build.rs +++ b/build.rs @@ -318,18 +318,18 @@ fn parse_sysconfigdata(config_path: impl AsRef) -> Result Result<(InterpreterConfig, BuildFlags)> /// Extract compilation vars from the specified interpreter. fn get_config_from_interpreter(interpreter: &Path) -> Result { let script = r#" +import os.path import platform import struct import sys -import sysconfig -import os.path +from sysconfig import get_config_var PYPY = platform.python_implementation() == "PyPy" # Anaconda based python distributions have a static python executable, but include # the shared library. Use the shared library for embedding to avoid rust trying to # LTO the static library (and failing with newer gcc's, because it is old). -ANACONDA = os.path.exists(os.path.join(sys.base_prefix, 'conda-meta')) +ANACONDA = os.path.exists(os.path.join(sys.base_prefix, "conda-meta")) -libdir = sysconfig.get_config_var('LIBDIR') +libdir = get_config_var("LIBDIR") print("version_major", sys.version_info[0]) print("version_minor", sys.version_info[1]) print("implementation", platform.python_implementation()) if libdir is not None: print("libdir", libdir) -print("ld_version", sysconfig.get_config_var('LDVERSION') or sysconfig.get_config_var('py_version_short')) +print("ld_version", get_config_var("LDVERSION") or get_config_var("py_version_short")) print("base_prefix", sys.base_prefix) -print("framework", bool(sysconfig.get_config_var('PYTHONFRAMEWORK'))) -print("shared", PYPY or ANACONDA or bool(sysconfig.get_config_var('Py_ENABLE_SHARED'))) +print("framework", bool(get_config_var("PYTHONFRAMEWORK"))) +print("shared", PYPY or ANACONDA or bool(get_config_var("Py_ENABLE_SHARED"))) print("executable", sys.executable) print("calcsize_pointer", struct.calcsize("P")) "#;