Skip to content

Commit 88fbfb3

Browse files
authored
fix: sysconfig (#1858)
1 parent ffb1bb1 commit 88fbfb3

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

docker/build_scripts/build-cpython.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ unset _PYTHON_HOST_PLATFORM
7373
# configure with hardening options only for the interpreter & stdlib C extensions
7474
# do not change the default for user built extension (yet?)
7575
./configure \
76+
CC=gcc \
77+
CXX=g++ \
7678
CFLAGS_NODIST="${MANYLINUX_CFLAGS} ${MANYLINUX_CPPFLAGS}" \
7779
LDFLAGS_NODIST="${MANYLINUX_LDFLAGS} ${LDFLAGS_EXTRA}" \
7880
"--prefix=${PREFIX}" "${CONFIGURE_ARGS[@]}" > /dev/null

docker/tests/modules-check.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import os
2+
import sys
3+
import sysconfig
14
import unittest
25

36

@@ -7,7 +10,7 @@ def test_sqlite3(self):
710
# c.f. https://github.com/pypa/manylinux/issues/1030
811
import sqlite3
912

10-
print(f"{sqlite3.sqlite_version=}", end=" ", flush=True)
13+
print(f"{sqlite3.sqlite_version=}", end=" ", file=sys.stderr)
1114
assert sqlite3.sqlite_version_info[0:2] >= (3, 50)
1215

1316
# When the extension is not installed, it raises:
@@ -19,7 +22,7 @@ def test_tkinter(self):
1922
# Make sure tkinter module can be loaded properly
2023
import tkinter as tk
2124

22-
print(f"{tk.TkVersion=}", end=" ", flush=True)
25+
print(f"{tk.TkVersion=}", end=" ", file=sys.stderr)
2326
assert tk.TkVersion >= 8.6
2427

2528
def test_gdbm(self):
@@ -38,12 +41,27 @@ def test_ncurses(self):
3841
# depends on libncurses
3942
import curses
4043

41-
print(f"{curses.ncurses_version=}", end=" ", flush=True)
44+
print(f"{curses.ncurses_version=}", end=" ", file=sys.stderr)
4245

4346
def test_ctypes(self):
4447
# depends on libffi
4548
import ctypes # noqa: F401
4649

50+
def test_sysconfig(self):
51+
config_vars = sysconfig.get_config_vars()
52+
cc = config_vars["CC"]
53+
cxx = config_vars["CXX"]
54+
pthread = (
55+
" -pthread"
56+
if os.environ["AUDITWHEEL_POLICY"]
57+
in {"manylinux2014", "manylinux_2_28", "manylinux_2_31"}
58+
else ""
59+
)
60+
assert cc == f"gcc{pthread}", cc
61+
assert cxx == f"g++{pthread}", cxx
62+
assert config_vars["LDSHARED"] == f"{cc} -shared", config_vars["LDSHARED"]
63+
assert config_vars["LDCXXSHARED"] == f"{cxx} -shared", config_vars["LDCXXSHARED"]
64+
4765

4866
if __name__ == "__main__":
4967
unittest.main(verbosity=2)

0 commit comments

Comments
 (0)