gh-93939: Build C extensions without setup.py (GH-94474)

Combines GH-93940, GH-94452, and GH-94433
This commit is contained in:
Christian Heimes 2022-07-14 09:51:49 +02:00 committed by GitHub
parent b03a9e8c8a
commit 81dca70d70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 89 additions and 1506 deletions

View File

@ -356,6 +356,12 @@ Changes in the Python API
Build Changes Build Changes
============= =============
* Python no longer uses ``setup.py`` to build shared C extension modules.
Build parameters like headers and libraries are detected in ``configure``
script. Extensions are built by ``Makefile``. Most extensions use
``pkg-config`` and fall back to manual detection.
(Contributed by Christian Heimes in :gh:`93939`.)
* ``va_start()`` with two parameters, like ``va_start(args, format),`` * ``va_start()`` with two parameters, like ``va_start(args, format),``
is now required to build Python. is now required to build Python.
``va_start()`` is no longer called with a single parameter. ``va_start()`` is no longer called with a single parameter.

View File

@ -1,97 +0,0 @@
"""
Basic subprocess implementation for POSIX which only uses os functions. Only
implement features required by setup.py to build C extension modules when
subprocess is unavailable. setup.py is not used on Windows.
"""
import os
# distutils.spawn used by distutils.command.build_ext
# calls subprocess.Popen().wait()
class Popen:
def __init__(self, cmd, env=None):
self._cmd = cmd
self._env = env
self.returncode = None
def wait(self):
pid = os.fork()
if pid == 0:
# Child process
try:
if self._env is not None:
os.execve(self._cmd[0], self._cmd, self._env)
else:
os.execv(self._cmd[0], self._cmd)
finally:
os._exit(1)
else:
# Parent process
_, status = os.waitpid(pid, 0)
self.returncode = os.waitstatus_to_exitcode(status)
return self.returncode
def _check_cmd(cmd):
# Use regex [a-zA-Z0-9./-]+: reject empty string, space, etc.
safe_chars = []
for first, last in (("a", "z"), ("A", "Z"), ("0", "9")):
for ch in range(ord(first), ord(last) + 1):
safe_chars.append(chr(ch))
safe_chars.append("./-")
safe_chars = ''.join(safe_chars)
if isinstance(cmd, (tuple, list)):
check_strs = cmd
elif isinstance(cmd, str):
check_strs = [cmd]
else:
return False
for arg in check_strs:
if not isinstance(arg, str):
return False
if not arg:
# reject empty string
return False
for ch in arg:
if ch not in safe_chars:
return False
return True
# _aix_support used by distutil.util calls subprocess.check_output()
def check_output(cmd, **kwargs):
if kwargs:
raise NotImplementedError(repr(kwargs))
if not _check_cmd(cmd):
raise ValueError(f"unsupported command: {cmd!r}")
tmp_filename = "check_output.tmp"
if not isinstance(cmd, str):
cmd = " ".join(cmd)
cmd = f"{cmd} >{tmp_filename}"
try:
# system() spawns a shell
status = os.system(cmd)
exitcode = os.waitstatus_to_exitcode(status)
if exitcode:
raise ValueError(f"Command {cmd!r} returned non-zero "
f"exit status {exitcode!r}")
try:
with open(tmp_filename, "rb") as fp:
stdout = fp.read()
except FileNotFoundError:
stdout = b''
finally:
try:
os.unlink(tmp_filename)
except OSError:
pass
return stdout

View File

@ -21,6 +21,11 @@ try:
except ImportError: except ImportError:
_testcapi = None _testcapi = None
try:
import xxsubtype
except ImportError:
xxsubtype = None
class OperatorsTest(unittest.TestCase): class OperatorsTest(unittest.TestCase):
@ -299,6 +304,7 @@ class OperatorsTest(unittest.TestCase):
self.assertEqual(float.__rsub__(3.0, 1), -2.0) self.assertEqual(float.__rsub__(3.0, 1), -2.0)
@support.impl_detail("the module 'xxsubtype' is internal") @support.impl_detail("the module 'xxsubtype' is internal")
@unittest.skipIf(xxsubtype is None, "requires xxsubtype module")
def test_spam_lists(self): def test_spam_lists(self):
# Testing spamlist operations... # Testing spamlist operations...
import copy, xxsubtype as spam import copy, xxsubtype as spam
@ -343,6 +349,7 @@ class OperatorsTest(unittest.TestCase):
self.assertEqual(a.getstate(), 42) self.assertEqual(a.getstate(), 42)
@support.impl_detail("the module 'xxsubtype' is internal") @support.impl_detail("the module 'xxsubtype' is internal")
@unittest.skipIf(xxsubtype is None, "requires xxsubtype module")
def test_spam_dicts(self): def test_spam_dicts(self):
# Testing spamdict operations... # Testing spamdict operations...
import copy, xxsubtype as spam import copy, xxsubtype as spam
@ -1600,6 +1607,7 @@ order (MRO) for bases """
self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10) self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10)
@support.impl_detail("the module 'xxsubtype' is internal") @support.impl_detail("the module 'xxsubtype' is internal")
@unittest.skipIf(xxsubtype is None, "requires xxsubtype module")
def test_classmethods_in_c(self): def test_classmethods_in_c(self):
# Testing C-based class methods... # Testing C-based class methods...
import xxsubtype as spam import xxsubtype as spam
@ -1683,6 +1691,7 @@ order (MRO) for bases """
self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10) self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10)
@support.impl_detail("the module 'xxsubtype' is internal") @support.impl_detail("the module 'xxsubtype' is internal")
@unittest.skipIf(xxsubtype is None, "requires xxsubtype module")
def test_staticmethods_in_c(self): def test_staticmethods_in_c(self):
# Testing C-based static methods... # Testing C-based static methods...
import xxsubtype as spam import xxsubtype as spam

View File

@ -211,12 +211,6 @@ ENSUREPIP= @ENSUREPIP@
LIBMPDEC_A= Modules/_decimal/libmpdec/libmpdec.a LIBMPDEC_A= Modules/_decimal/libmpdec/libmpdec.a
LIBEXPAT_A= Modules/expat/libexpat.a LIBEXPAT_A= Modules/expat/libexpat.a
# OpenSSL options for setup.py so sysconfig can pick up AC_SUBST() vars.
OPENSSL_INCLUDES=@OPENSSL_INCLUDES@
OPENSSL_LIBS=@OPENSSL_LIBS@
OPENSSL_LDFLAGS=@OPENSSL_LDFLAGS@
OPENSSL_RPATH=@OPENSSL_RPATH@
# Module state, compiler flags and linker flags # Module state, compiler flags and linker flags
# Empty CFLAGS and LDFLAGS are omitted. # Empty CFLAGS and LDFLAGS are omitted.
# states: # states:
@ -582,9 +576,10 @@ LIBEXPAT_HEADERS= \
# Default target # Default target
all: @DEF_MAKE_ALL_RULE@ all: @DEF_MAKE_ALL_RULE@
build_all: check-clean-src $(BUILDPYTHON) platform oldsharedmods sharedmods \ build_all: check-clean-src $(BUILDPYTHON) platform sharedmods \
gdbhooks Programs/_testembed scripts gdbhooks Programs/_testembed scripts checksharedmods
build_wasm: check-clean-src $(BUILDPYTHON) platform oldsharedmods python-config build_wasm: check-clean-src $(BUILDPYTHON) platform sharedmods \
python-config checksharedmods
# Check that the source is clean when building out of source. # Check that the source is clean when building out of source.
check-clean-src: check-clean-src:
@ -726,22 +721,6 @@ $(srcdir)/Modules/_blake2/blake2s_impl.c: $(srcdir)/Modules/_blake2/blake2b_impl
$(PYTHON_FOR_REGEN) $(srcdir)/Modules/_blake2/blake2b2s.py $(PYTHON_FOR_REGEN) $(srcdir)/Modules/_blake2/blake2b2s.py
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py -f $@ $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py -f $@
# Build the shared modules
# Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
# -s, --silent or --quiet is always the first char.
# Under BSD make, MAKEFLAGS might be " -s -v x=y".
# Ignore macros passed by GNU make, passed after --
sharedmods: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt @LIBMPDEC_INTERNAL@ @LIBEXPAT_INTERNAL@
@case "`echo X $$MAKEFLAGS | sed 's/^X //;s/ -- .*//'`" in \
*\ -s*|s*) quiet="-q";; \
*) quiet="";; \
esac; \
echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
# Build static library # Build static library
$(LIBRARY): $(LIBRARY_OBJS) $(LIBRARY): $(LIBRARY_OBJS)
-rm -f $@ -rm -f $@
@ -832,10 +811,6 @@ python.worker.js: $(srcdir)/Tools/wasm/python.worker.js
# Build static libmpdec.a # Build static libmpdec.a
LIBMPDEC_CFLAGS=@LIBMPDEC_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED) LIBMPDEC_CFLAGS=@LIBMPDEC_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED)
# for setup.py
DECIMAL_CFLAGS=@LIBMPDEC_CFLAGS@
DECIMAL_LDFLAGS=@LIBMPDEC_LDFLAGS@
# "%.o: %c" is not portable # "%.o: %c" is not portable
Modules/_decimal/libmpdec/basearith.o: $(srcdir)/Modules/_decimal/libmpdec/basearith.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS) Modules/_decimal/libmpdec/basearith.o: $(srcdir)/Modules/_decimal/libmpdec/basearith.c $(LIBMPDEC_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/basearith.c $(CC) -c $(LIBMPDEC_CFLAGS) -o $@ $(srcdir)/Modules/_decimal/libmpdec/basearith.c
@ -890,10 +865,6 @@ $(LIBMPDEC_A): $(LIBMPDEC_OBJS)
# Build static libexpat.a # Build static libexpat.a
LIBEXPAT_CFLAGS=@LIBEXPAT_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED) LIBEXPAT_CFLAGS=@LIBEXPAT_CFLAGS@ $(PY_STDMODULE_CFLAGS) $(CCSHARED)
# for setup.py
EXPAT_CFLAGS=@LIBEXPAT_CFLAGS@
EXPAT_LDFLAGS=@LIBEXPAT_LDFLAGS@
Modules/expat/xmlparse.o: $(srcdir)/Modules/expat/xmlparse.c $(LIBEXPAT_HEADERS) $(PYTHON_HEADERS) Modules/expat/xmlparse.o: $(srcdir)/Modules/expat/xmlparse.c $(LIBEXPAT_HEADERS) $(PYTHON_HEADERS)
$(CC) -c $(LIBEXPAT_CFLAGS) -o $@ $(srcdir)/Modules/expat/xmlparse.c $(CC) -c $(LIBEXPAT_CFLAGS) -o $@ $(srcdir)/Modules/expat/xmlparse.c
@ -910,7 +881,7 @@ $(LIBEXPAT_A): $(LIBEXPAT_OBJS)
# create relative links from build/lib.platform/egg.so to Modules/egg.so # create relative links from build/lib.platform/egg.so to Modules/egg.so
# pybuilddir.txt is created too late. We cannot use it in Makefile # pybuilddir.txt is created too late. We cannot use it in Makefile
# targets. ln --relative is not portable. # targets. ln --relative is not portable.
oldsharedmods: $(SHAREDMODS) pybuilddir.txt sharedmods: $(SHAREDMODS) pybuilddir.txt
@target=`cat pybuilddir.txt`; \ @target=`cat pybuilddir.txt`; \
$(MKDIR_P) $$target; \ $(MKDIR_P) $$target; \
for mod in X $(SHAREDMODS); do \ for mod in X $(SHAREDMODS); do \
@ -919,7 +890,8 @@ oldsharedmods: $(SHAREDMODS) pybuilddir.txt
fi; \ fi; \
done done
checksharedmods: oldsharedmods sharedmods $(PYTHON_FOR_BUILD_DEPS) # dependency on BUILDPYTHON ensures that the target is run last
checksharedmods: sharedmods $(PYTHON_FOR_BUILD_DEPS) $(BUILDPYTHON)
@$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/check_extension_modules.py @$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/check_extension_modules.py
Modules/Setup.local: Modules/Setup.local:
@ -942,7 +914,7 @@ Makefile Modules/config.c: Makefile.pre \
$(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \ $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
-s Modules \ -s Modules \
Modules/Setup.local \ Modules/Setup.local \
@MODULES_SETUP_STDLIB@ \ Modules/Setup.stdlib \
Modules/Setup.bootstrap \ Modules/Setup.bootstrap \
$(srcdir)/Modules/Setup $(srcdir)/Modules/Setup
@mv config.c Modules @mv config.c Modules
@ -1762,13 +1734,13 @@ altinstall: commoninstall
commoninstall: check-clean-src @FRAMEWORKALTINSTALLFIRST@ \ commoninstall: check-clean-src @FRAMEWORKALTINSTALLFIRST@ \
altbininstall libinstall inclinstall libainstall \ altbininstall libinstall inclinstall libainstall \
sharedinstall oldsharedinstall altmaninstall \ sharedinstall altmaninstall \
@FRAMEWORKALTINSTALLLAST@ @FRAMEWORKALTINSTALLLAST@
# Install shared libraries enabled by Setup # Install shared libraries enabled by Setup
DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED) DESTDIRS= $(exec_prefix) $(LIBDIR) $(BINLIBDEST) $(DESTSHARED)
oldsharedinstall: $(DESTSHARED) all sharedinstall: $(DESTSHARED) all
@for i in X $(SHAREDMODS); do \ @for i in X $(SHAREDMODS); do \
if test $$i != X; then \ if test $$i != X; then \
echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \ echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \
@ -2252,17 +2224,6 @@ libainstall: all scripts
else true; \ else true; \
fi fi
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: all
$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
--prefix=$(prefix) \
--install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \
--root=$(DESTDIR)/
-rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py
-rm -r $(DESTDIR)$(DESTSHARED)/__pycache__
# Here are a couple of targets for MacOSX again, to install a full # Here are a couple of targets for MacOSX again, to install a full
# framework-based Python. frameworkinstall installs everything, the # framework-based Python. frameworkinstall installs everything, the
# subtargets install specific parts. Much of the actual work is offloaded to # subtargets install specific parts. Much of the actual work is offloaded to
@ -2536,10 +2497,10 @@ update-config:
Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h Python/thread.o: @THREADHEADERS@ $(srcdir)/Python/condvar.h
# Declare targets that aren't real files # Declare targets that aren't real files
.PHONY: all build_all build_wasm sharedmods check-clean-src .PHONY: all build_all build_wasm check-clean-src
.PHONY: oldsharedmods checksharedmods test quicktest .PHONY: sharedmods checksharedmods test quicktest
.PHONY: install altinstall oldsharedinstall bininstall altbininstall .PHONY: install altinstall sharedinstall bininstall altbininstall
.PHONY: maninstall libinstall inclinstall libainstall sharedinstall .PHONY: maninstall libinstall inclinstall libainstall
.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
.PHONY: frameworkaltinstallunixtools recheck clean clobber distclean .PHONY: frameworkaltinstallunixtools recheck clean clobber distclean

View File

@ -0,0 +1,2 @@
C extension modules are now built by ``configure`` and ``make``
instead of :mod:`distutils` and ``setup.py``.

View File

@ -275,7 +275,7 @@ PYTHONPATH=$(COREPYTHONPATH)
#xx xxmodule.c #xx xxmodule.c
#xxlimited xxlimited.c #xxlimited xxlimited.c
#xxlimited_35 xxlimited_35.c #xxlimited_35 xxlimited_35.c
xxsubtype xxsubtype.c # Required for the test suite to pass! #xxsubtype xxsubtype.c
# Testing # Testing

View File

@ -165,6 +165,7 @@
############################################################################ ############################################################################
# Test modules # Test modules
@MODULE_XXSUBTYPE_TRUE@xxsubtype xxsubtype.c
@MODULE__XXTESTFUZZ_TRUE@_xxtestfuzz _xxtestfuzz/_xxtestfuzz.c _xxtestfuzz/fuzzer.c @MODULE__XXTESTFUZZ_TRUE@_xxtestfuzz _xxtestfuzz/_xxtestfuzz.c _xxtestfuzz/fuzzer.c
@MODULE__TESTBUFFER_TRUE@_testbuffer _testbuffer.c @MODULE__TESTBUFFER_TRUE@_testbuffer _testbuffer.c
@MODULE__TESTINTERNALCAPI_TRUE@_testinternalcapi _testinternalcapi.c @MODULE__TESTINTERNALCAPI_TRUE@_testinternalcapi _testinternalcapi.c

View File

@ -9,7 +9,6 @@ static const char* _Py_stdlib_module_names[] = {
"_asyncio", "_asyncio",
"_bisect", "_bisect",
"_blake2", "_blake2",
"_bootsubprocess",
"_bz2", "_bz2",
"_codecs", "_codecs",
"_codecs_cn", "_codecs_cn",

View File

@ -130,10 +130,11 @@ class ModuleChecker:
pybuilddir_txt = "pybuilddir.txt" pybuilddir_txt = "pybuilddir.txt"
setup_files = ( setup_files = (
SRC_DIR / "Modules/Setup", # see end of configure.ac
"Modules/Setup.local", "Modules/Setup.local",
"Modules/Setup.bootstrap",
"Modules/Setup.stdlib", "Modules/Setup.stdlib",
"Modules/Setup.bootstrap",
SRC_DIR / "Modules/Setup",
) )
def __init__(self, cross_compiling: bool = False, strict: bool = False): def __init__(self, cross_compiling: bool = False, strict: bool = False):
@ -308,12 +309,6 @@ class ModuleChecker:
MODBUILT_NAMES: modules in *static* block MODBUILT_NAMES: modules in *static* block
MODSHARED_NAMES: modules in *shared* block MODSHARED_NAMES: modules in *shared* block
MODDISABLED_NAMES: modules in *disabled* block MODDISABLED_NAMES: modules in *disabled* block
Modules built by setup.py addext() have a MODULE_{modname}_STATE entry,
but are not listed in MODSHARED_NAMES.
Modules built by old-style setup.py add() have neither a MODULE_{modname}
entry nor an entry in MODSHARED_NAMES.
""" """
moddisabled = set(sysconfig.get_config_var("MODDISABLED_NAMES").split()) moddisabled = set(sysconfig.get_config_var("MODDISABLED_NAMES").split())
if self.cross_compiling: if self.cross_compiling:

View File

@ -12,7 +12,6 @@ from check_extension_modules import ModuleChecker
SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
STDLIB_PATH = os.path.join(SRC_DIR, 'Lib') STDLIB_PATH = os.path.join(SRC_DIR, 'Lib')
SETUP_PY = os.path.join(SRC_DIR, 'setup.py')
IGNORE = { IGNORE = {
'__init__', '__init__',
@ -64,15 +63,6 @@ def list_packages(names):
names.add(name) names.add(name)
# Extension modules built by setup.py
def list_setup_extensions(names):
cmd = [sys.executable, SETUP_PY, "-q", "build", "--list-module-names"]
output = subprocess.check_output(cmd)
output = output.decode("utf8")
extensions = output.splitlines()
names |= set(extensions)
# Built-in and extension modules built by Modules/Setup* # Built-in and extension modules built by Modules/Setup*
# includes Windows and macOS extensions. # includes Windows and macOS extensions.
def list_modules_setup_extensions(names): def list_modules_setup_extensions(names):
@ -103,7 +93,6 @@ def list_frozen(names):
def list_modules(): def list_modules():
names = set(sys.builtin_module_names) names = set(sys.builtin_module_names)
list_modules_setup_extensions(names) list_modules_setup_extensions(names)
list_setup_extensions(names)
list_packages(names) list_packages(names)
list_python_modules(names) list_python_modules(names)
list_frozen(names) list_frozen(names)

View File

@ -358,7 +358,7 @@ class AbstractBuilder(object):
env["LD_RUN_PATH"] = self.lib_dir env["LD_RUN_PATH"] = self.lib_dir
log.info("Rebuilding Python modules") log.info("Rebuilding Python modules")
cmd = [sys.executable, os.path.join(PYTHONROOT, "setup.py"), "build"] cmd = ["make", "sharedmods", "checksharedmods"]
self._subprocess_call(cmd, env=env) self._subprocess_call(cmd, env=env)
self.check_imports() self.check_imports()
@ -472,7 +472,7 @@ def main():
start = datetime.now() start = datetime.now()
if args.steps in {'modules', 'tests'}: if args.steps in {'modules', 'tests'}:
for name in ['setup.py', 'Modules/_ssl.c']: for name in ['Makefile.pre.in', 'Modules/_ssl.c']:
if not os.path.isfile(os.path.join(PYTHONROOT, name)): if not os.path.isfile(os.path.join(PYTHONROOT, name)):
parser.error( parser.error(
"Must be executed from CPython build dir" "Must be executed from CPython build dir"

69
configure generated vendored
View File

@ -632,6 +632,8 @@ MODULE__CTYPES_TEST_FALSE
MODULE__CTYPES_TEST_TRUE MODULE__CTYPES_TEST_TRUE
MODULE__XXTESTFUZZ_FALSE MODULE__XXTESTFUZZ_FALSE
MODULE__XXTESTFUZZ_TRUE MODULE__XXTESTFUZZ_TRUE
MODULE_XXSUBTYPE_FALSE
MODULE_XXSUBTYPE_TRUE
MODULE__TESTMULTIPHASE_FALSE MODULE__TESTMULTIPHASE_FALSE
MODULE__TESTMULTIPHASE_TRUE MODULE__TESTMULTIPHASE_TRUE
MODULE__TESTIMPORTMULTIPLE_FALSE MODULE__TESTIMPORTMULTIPLE_FALSE
@ -786,12 +788,10 @@ MODULE_TIME_FALSE
MODULE_TIME_TRUE MODULE_TIME_TRUE
MODULE__IO_FALSE MODULE__IO_FALSE
MODULE__IO_TRUE MODULE__IO_TRUE
MODULES_SETUP_STDLIB
MODULE_BUILDTYPE MODULE_BUILDTYPE
TEST_MODULES TEST_MODULES
LIBB2_LIBS LIBB2_LIBS
LIBB2_CFLAGS LIBB2_CFLAGS
OPENSSL_RPATH
OPENSSL_LDFLAGS OPENSSL_LDFLAGS
OPENSSL_LIBS OPENSSL_LIBS
OPENSSL_INCLUDES OPENSSL_INCLUDES
@ -852,13 +852,11 @@ LIBSQLITE3_CFLAGS
LIBNSL_LIBS LIBNSL_LIBS
LIBNSL_CFLAGS LIBNSL_CFLAGS
LIBMPDEC_INTERNAL LIBMPDEC_INTERNAL
LIBMPDEC_LDFLAGS
LIBMPDEC_CFLAGS LIBMPDEC_CFLAGS
MODULE__CTYPES_MALLOC_CLOSURE MODULE__CTYPES_MALLOC_CLOSURE
LIBFFI_LIBS LIBFFI_LIBS
LIBFFI_CFLAGS LIBFFI_CFLAGS
LIBEXPAT_INTERNAL LIBEXPAT_INTERNAL
LIBEXPAT_LDFLAGS
LIBEXPAT_CFLAGS LIBEXPAT_CFLAGS
TZPATH TZPATH
LIBUUID_LIBS LIBUUID_LIBS
@ -12026,7 +12024,6 @@ fi
# Check for use of the system libffi library # Check for use of the system libffi library
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-system-ffi" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-system-ffi" >&5
$as_echo_n "checking for --with-system-ffi... " >&6; } $as_echo_n "checking for --with-system-ffi... " >&6; }
@ -12530,7 +12527,6 @@ fi
# Check whether _decimal should use a coroutine-local or thread-local context # Check whether _decimal should use a coroutine-local or thread-local context
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-decimal-contextvar" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-decimal-contextvar" >&5
$as_echo_n "checking for --with-decimal-contextvar... " >&6; } $as_echo_n "checking for --with-decimal-contextvar... " >&6; }
@ -24024,7 +24020,6 @@ esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSSL_RPATH" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSSL_RPATH" >&5
$as_echo "$OPENSSL_RPATH" >&6; } $as_echo "$OPENSSL_RPATH" >&6; }
# This static linking is NOT OFFICIALLY SUPPORTED and not advertised. # This static linking is NOT OFFICIALLY SUPPORTED and not advertised.
# Requires static OpenSSL build with position-independent code. Some features # Requires static OpenSSL build with position-independent code. Some features
# like DSO engines or external OSSL providers don't work. Only tested with GCC # like DSO engines or external OSSL providers don't work. Only tested with GCC
@ -24503,22 +24498,6 @@ case $host_cpu in #(
esac esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for additional Modules/Setup files" >&5
$as_echo_n "checking for additional Modules/Setup files... " >&6; }
case $ac_sys_system in #(
Emscripten) :
MODULES_SETUP_STDLIB=Modules/Setup.stdlib ;; #(
WASI) :
MODULES_SETUP_STDLIB=Modules/Setup.stdlib ;; #(
*) :
MODULES_SETUP_STDLIB=
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MODULES_SETUP_STDLIB" >&5
$as_echo "$MODULES_SETUP_STDLIB" >&6; }
MODULE_BLOCK= MODULE_BLOCK=
@ -26683,6 +26662,40 @@ fi
$as_echo "$py_cv_module__testmultiphase" >&6; } $as_echo "$py_cv_module__testmultiphase" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module xxsubtype" >&5
$as_echo_n "checking for stdlib extension module xxsubtype... " >&6; }
if test "$py_cv_module_xxsubtype" != "n/a"; then :
if test "$TEST_MODULES" = yes; then :
if true; then :
py_cv_module_xxsubtype=yes
else
py_cv_module_xxsubtype=missing
fi
else
py_cv_module_xxsubtype=disabled
fi
fi
as_fn_append MODULE_BLOCK "MODULE_XXSUBTYPE_STATE=$py_cv_module_xxsubtype$as_nl"
if test "x$py_cv_module_xxsubtype" = xyes; then :
fi
if test "$py_cv_module_xxsubtype" = yes; then
MODULE_XXSUBTYPE_TRUE=
MODULE_XXSUBTYPE_FALSE='#'
else
MODULE_XXSUBTYPE_TRUE='#'
MODULE_XXSUBTYPE_FALSE=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_xxsubtype" >&5
$as_echo "$py_cv_module_xxsubtype" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _xxtestfuzz" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _xxtestfuzz" >&5
$as_echo_n "checking for stdlib extension module _xxtestfuzz... " >&6; } $as_echo_n "checking for stdlib extension module _xxtestfuzz... " >&6; }
if test "$py_cv_module__xxtestfuzz" != "n/a"; then : if test "$py_cv_module__xxtestfuzz" != "n/a"; then :
@ -27248,6 +27261,10 @@ if test -z "${MODULE__TESTMULTIPHASE_TRUE}" && test -z "${MODULE__TESTMULTIPHASE
as_fn_error $? "conditional \"MODULE__TESTMULTIPHASE\" was never defined. as_fn_error $? "conditional \"MODULE__TESTMULTIPHASE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi fi
if test -z "${MODULE_XXSUBTYPE_TRUE}" && test -z "${MODULE_XXSUBTYPE_FALSE}"; then
as_fn_error $? "conditional \"MODULE_XXSUBTYPE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE__XXTESTFUZZ_TRUE}" && test -z "${MODULE__XXTESTFUZZ_FALSE}"; then if test -z "${MODULE__XXTESTFUZZ_TRUE}" && test -z "${MODULE__XXTESTFUZZ_FALSE}"; then
as_fn_error $? "conditional \"MODULE__XXTESTFUZZ\" was never defined. as_fn_error $? "conditional \"MODULE__XXTESTFUZZ\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@ -28467,7 +28484,11 @@ fi
$as_echo "$as_me: creating Makefile" >&6;} $as_echo "$as_me: creating Makefile" >&6;}
$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
-s Modules \ -s Modules \
Modules/Setup.local $MODULES_SETUP_STDLIB Modules/Setup.bootstrap $srcdir/Modules/Setup Modules/Setup.local Modules/Setup.stdlib Modules/Setup.bootstrap $srcdir/Modules/Setup
if test $? -ne 0; then
as_fn_error $? "makesetup failed" "$LINENO" 5
fi
mv config.c Modules mv config.c Modules
if test -z "$PKG_CONFIG"; then if test -z "$PKG_CONFIG"; then

View File

@ -3569,7 +3569,6 @@ AS_VAR_IF([with_system_expat], [yes], [
]) ])
AC_SUBST([LIBEXPAT_CFLAGS]) AC_SUBST([LIBEXPAT_CFLAGS])
AC_SUBST([LIBEXPAT_LDFLAGS])
AC_SUBST([LIBEXPAT_INTERNAL]) AC_SUBST([LIBEXPAT_INTERNAL])
# Check for use of the system libffi library # Check for use of the system libffi library
@ -3676,7 +3675,6 @@ AS_VAR_IF([with_system_libmpdec], [yes], [
]) ])
AC_SUBST([LIBMPDEC_CFLAGS]) AC_SUBST([LIBMPDEC_CFLAGS])
AC_SUBST([LIBMPDEC_LDFLAGS])
AC_SUBST([LIBMPDEC_INTERNAL]) AC_SUBST([LIBMPDEC_INTERNAL])
# Check whether _decimal should use a coroutine-local or thread-local context # Check whether _decimal should use a coroutine-local or thread-local context
@ -6736,7 +6734,6 @@ AS_CASE($with_openssl_rpath,
] ]
) )
AC_MSG_RESULT($OPENSSL_RPATH) AC_MSG_RESULT($OPENSSL_RPATH)
AC_SUBST([OPENSSL_RPATH])
# This static linking is NOT OFFICIALLY SUPPORTED and not advertised. # This static linking is NOT OFFICIALLY SUPPORTED and not advertised.
# Requires static OpenSSL build with position-independent code. Some features # Requires static OpenSSL build with position-independent code. Some features
@ -6983,17 +6980,6 @@ AS_CASE([$host_cpu],
) )
AC_SUBST([MODULE_BUILDTYPE]) AC_SUBST([MODULE_BUILDTYPE])
dnl Use Modules/Setup.stdlib as additional provider?
AC_MSG_CHECKING([for additional Modules/Setup files])
AS_CASE([$ac_sys_system],
[Emscripten], [MODULES_SETUP_STDLIB=Modules/Setup.stdlib],
[WASI], [MODULES_SETUP_STDLIB=Modules/Setup.stdlib],
[MODULES_SETUP_STDLIB=]
)
AC_MSG_RESULT([$MODULES_SETUP_STDLIB])
AC_SUBST([MODULES_SETUP_STDLIB])
dnl _MODULE_BLOCK_ADD([VAR], [VALUE]) dnl _MODULE_BLOCK_ADD([VAR], [VALUE])
dnl internal: adds $1=quote($2) to MODULE_BLOCK dnl internal: adds $1=quote($2) to MODULE_BLOCK
AC_DEFUN([_MODULE_BLOCK_ADD], [AS_VAR_APPEND([MODULE_BLOCK], ["$1=_AS_QUOTE([$2])$as_nl"])]) AC_DEFUN([_MODULE_BLOCK_ADD], [AS_VAR_APPEND([MODULE_BLOCK], ["$1=_AS_QUOTE([$2])$as_nl"])])
@ -7198,6 +7184,7 @@ PY_STDLIB_MOD([_testinternalcapi], [test "$TEST_MODULES" = yes])
PY_STDLIB_MOD([_testbuffer], [test "$TEST_MODULES" = yes]) PY_STDLIB_MOD([_testbuffer], [test "$TEST_MODULES" = yes])
PY_STDLIB_MOD([_testimportmultiple], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes]) PY_STDLIB_MOD([_testimportmultiple], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes]) PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
PY_STDLIB_MOD([xxsubtype], [test "$TEST_MODULES" = yes])
PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes]) PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes])
PY_STDLIB_MOD([_ctypes_test], PY_STDLIB_MOD([_ctypes_test],
[test "$TEST_MODULES" = yes], [test "$have_libffi" = yes -a "$ac_cv_func_dlopen" = yes], [test "$TEST_MODULES" = yes], [test "$have_libffi" = yes -a "$ac_cv_func_dlopen" = yes],
@ -7227,7 +7214,11 @@ fi
AC_MSG_NOTICE([creating Makefile]) AC_MSG_NOTICE([creating Makefile])
$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
-s Modules \ -s Modules \
Modules/Setup.local $MODULES_SETUP_STDLIB Modules/Setup.bootstrap $srcdir/Modules/Setup Modules/Setup.local Modules/Setup.stdlib Modules/Setup.bootstrap $srcdir/Modules/Setup
if test $? -ne 0; then
AC_MSG_ERROR([makesetup failed])
fi
mv config.c Modules mv config.c Modules
if test -z "$PKG_CONFIG"; then if test -z "$PKG_CONFIG"; then

1294
setup.py

File diff suppressed because it is too large Load Diff