From d8bea50cd761ba47c8af65e02c3b3464fa9c8329 Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 1 Nov 2025 13:42:57 +0100 Subject: [PATCH] fix: sysconfig --- docker/build_scripts/build-cpython.sh | 2 ++ docker/tests/modules-check.py | 24 +++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/docker/build_scripts/build-cpython.sh b/docker/build_scripts/build-cpython.sh index 61460f54..4d2851d3 100755 --- a/docker/build_scripts/build-cpython.sh +++ b/docker/build_scripts/build-cpython.sh @@ -73,6 +73,8 @@ unset _PYTHON_HOST_PLATFORM # configure with hardening options only for the interpreter & stdlib C extensions # do not change the default for user built extension (yet?) ./configure \ + CC=gcc \ + CXX=g++ \ CFLAGS_NODIST="${MANYLINUX_CFLAGS} ${MANYLINUX_CPPFLAGS}" \ LDFLAGS_NODIST="${MANYLINUX_LDFLAGS} ${LDFLAGS_EXTRA}" \ "--prefix=${PREFIX}" "${CONFIGURE_ARGS[@]}" > /dev/null diff --git a/docker/tests/modules-check.py b/docker/tests/modules-check.py index ee66aee3..7a807707 100644 --- a/docker/tests/modules-check.py +++ b/docker/tests/modules-check.py @@ -1,3 +1,6 @@ +import os +import sys +import sysconfig import unittest @@ -7,7 +10,7 @@ def test_sqlite3(self): # c.f. https://github.com/pypa/manylinux/issues/1030 import sqlite3 - print(f"{sqlite3.sqlite_version=}", end=" ", flush=True) + print(f"{sqlite3.sqlite_version=}", end=" ", file=sys.stderr) assert sqlite3.sqlite_version_info[0:2] >= (3, 50) # When the extension is not installed, it raises: @@ -19,7 +22,7 @@ def test_tkinter(self): # Make sure tkinter module can be loaded properly import tkinter as tk - print(f"{tk.TkVersion=}", end=" ", flush=True) + print(f"{tk.TkVersion=}", end=" ", file=sys.stderr) assert tk.TkVersion >= 8.6 def test_gdbm(self): @@ -38,12 +41,27 @@ def test_ncurses(self): # depends on libncurses import curses - print(f"{curses.ncurses_version=}", end=" ", flush=True) + print(f"{curses.ncurses_version=}", end=" ", file=sys.stderr) def test_ctypes(self): # depends on libffi import ctypes # noqa: F401 + def test_sysconfig(self): + config_vars = sysconfig.get_config_vars() + cc = config_vars["CC"] + cxx = config_vars["CXX"] + pthread = ( + " -pthread" + if os.environ["AUDITWHEEL_POLICY"] + in {"manylinux2014", "manylinux_2_28", "manylinux_2_31"} + else "" + ) + assert cc == f"gcc{pthread}", cc + assert cxx == f"g++{pthread}", cxx + assert config_vars["LDSHARED"] == f"{cc} -shared", config_vars["LDSHARED"] + assert config_vars["LDCXXSHARED"] == f"{cxx} -shared", config_vars["LDCXXSHARED"] + if __name__ == "__main__": unittest.main(verbosity=2)