From f36c69a26ee880acf62a5ae8c5da49312e84c66d Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sat, 20 Nov 2021 17:43:10 +0200 Subject: [PATCH] bpo-45847: Port test modules to PY_STDLIB_MOD (GH-29660) --- Makefile.pre.in | 12 +- Modules/Setup.stdlib.in | 15 + configure | 596 ++++++++++++++++++++++++---------------- configure.ac | 17 +- setup.py | 30 +- 5 files changed, 412 insertions(+), 258 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index 312e52486f2..11ffdaabc61 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -211,11 +211,13 @@ OPENSSL_LIBS=@OPENSSL_LIBS@ OPENSSL_LDFLAGS=@OPENSSL_LDFLAGS@ OPENSSL_RPATH=@OPENSSL_RPATH@ -# Module compiler and linker flags -# yes: module is available -# missing: build dependency is missing -# disabled: module is disabled -# n/a: module is not available on the current platform +# Module state, compiler flags and linker flags +# Empty CFLAGS and LDFLAGS are omitted. +# states: +# * yes: module is available +# * missing: build dependency is missing +# * disabled: module is disabled +# * n/a: module is not available on the current platform # MODULE_EGG=yes # yes, missing, disabled, n/a # MODULE_EGG_CFLAGS= # MODULE_EGG_LDFLAGS= diff --git a/Modules/Setup.stdlib.in b/Modules/Setup.stdlib.in index 4e5c158c0fd..fa553fb524f 100644 --- a/Modules/Setup.stdlib.in +++ b/Modules/Setup.stdlib.in @@ -76,3 +76,18 @@ # _scproxy needs SystemConfiguration and CoreFoundation framework @MODULE__SCPROXY_TRUE@_scproxy _scproxy.c + + +############################################################################ +# Test modules + +@MODULE__XXTESTFUZZ_TRUE@_xxtestfuzz _xxtestfuzz/_xxtestfuzz.c _xxtestfuzz/fuzzer.c +@MODULE__TESTBUFFER_TRUE@_testbuffer _testbuffer.c +@MODULE__TESTINTERNALCAPI_TRUE@_testinternalcapi _testinternalcapi.c + +# Some testing modules MUST be built as shared libraries. +*shared* +@MODULE__TESTCAPI_TRUE@_testcapi _testcapimodule.c +@MODULE__TESTIMPORTMULTIPLE_TRUE@_testimportmultiple _testimportmultiple.c +@MODULE__TESTMULTIPHASE_TRUE@_testmultiphase _testmultiphase.c +@MODULE__CTYPES_TEST_TRUE@_ctypes_test _ctypes/_ctypes_test.c diff --git a/configure b/configure index dec3aa0586b..7d2ef8f9120 100755 --- a/configure +++ b/configure @@ -624,6 +624,20 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS MODULE_BLOCK +MODULE__CTYPES_TEST_FALSE +MODULE__CTYPES_TEST_TRUE +MODULE__XXTESTFUZZ_FALSE +MODULE__XXTESTFUZZ_TRUE +MODULE__TESTMULTIPHASE_FALSE +MODULE__TESTMULTIPHASE_TRUE +MODULE__TESTIMPORTMULTIPLE_FALSE +MODULE__TESTIMPORTMULTIPLE_TRUE +MODULE__TESTBUFFER_FALSE +MODULE__TESTBUFFER_TRUE +MODULE__TESTINTERNALCAPI_FALSE +MODULE__TESTINTERNALCAPI_TRUE +MODULE__TESTCAPI_FALSE +MODULE__TESTCAPI_TRUE MODULE__SQLITE3_FALSE MODULE__SQLITE3_TRUE MODULE__DECIMAL_FALSE @@ -19560,9 +19574,11 @@ esac as_fn_append MODULE_BLOCK "MODULE_OSSAUDIODEV=$py_cv_module_ossaudiodev$as_nl" if test "x$py_cv_module_ossaudiodev" = xyes; then : - as_fn_append MODULE_BLOCK "MODULE_OSSAUDIODEV_CFLAGS=$as_nl" - as_fn_append MODULE_BLOCK "MODULE_OSSAUDIODEV_LDFLAGS=$as_nl" - if true; then + + + +fi + if test "$py_cv_module_ossaudiodev" = yes; then MODULE_OSSAUDIODEV_TRUE= MODULE_OSSAUDIODEV_FALSE='#' else @@ -19570,19 +19586,6 @@ else MODULE_OSSAUDIODEV_FALSE= fi - -else - - if false; then - MODULE_OSSAUDIODEV_TRUE= - MODULE_OSSAUDIODEV_FALSE='#' -else - MODULE_OSSAUDIODEV_TRUE='#' - MODULE_OSSAUDIODEV_FALSE= -fi - - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_ossaudiodev" >&5 $as_echo "$py_cv_module_ossaudiodev" >&6; } @@ -19610,9 +19613,11 @@ esac as_fn_append MODULE_BLOCK "MODULE__SCPROXY=$py_cv_module__scproxy$as_nl" if test "x$py_cv_module__scproxy" = xyes; then : - as_fn_append MODULE_BLOCK "MODULE__SCPROXY_CFLAGS=$as_nl" + as_fn_append MODULE_BLOCK "MODULE__SCPROXY_LDFLAGS=-framework SystemConfiguration -framework CoreFoundation$as_nl" - if true; then + +fi + if test "$py_cv_module__scproxy" = yes; then MODULE__SCPROXY_TRUE= MODULE__SCPROXY_FALSE='#' else @@ -19620,19 +19625,6 @@ else MODULE__SCPROXY_FALSE= fi - -else - - if false; then - MODULE__SCPROXY_TRUE= - MODULE__SCPROXY_FALSE='#' -else - MODULE__SCPROXY_TRUE='#' - MODULE__SCPROXY_FALSE= -fi - - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__scproxy" >&5 $as_echo "$py_cv_module__scproxy" >&6; } @@ -19663,7 +19655,9 @@ esac as_fn_append MODULE_BLOCK "MODULE_PYEXPAT_CFLAGS=$LIBEXPAT_CFLAGS$as_nl" as_fn_append MODULE_BLOCK "MODULE_PYEXPAT_LDFLAGS=$LIBEXPAT_LDFLAGS$as_nl" - if true; then + +fi + if test "$py_cv_module_pyexpat" = yes; then MODULE_PYEXPAT_TRUE= MODULE_PYEXPAT_FALSE='#' else @@ -19671,19 +19665,6 @@ else MODULE_PYEXPAT_FALSE= fi - -else - - if false; then - MODULE_PYEXPAT_TRUE= - MODULE_PYEXPAT_FALSE='#' -else - MODULE_PYEXPAT_TRUE='#' - MODULE_PYEXPAT_FALSE= -fi - - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_pyexpat" >&5 $as_echo "$py_cv_module_pyexpat" >&6; } @@ -19712,8 +19693,10 @@ esac if test "x$py_cv_module__elementtree" = xyes; then : as_fn_append MODULE_BLOCK "MODULE__ELEMENTTREE_CFLAGS=$LIBEXPAT_CFLAGS$as_nl" - as_fn_append MODULE_BLOCK "MODULE__ELEMENTTREE_LDFLAGS=$as_nl" - if true; then + + +fi + if test "$py_cv_module__elementtree" = yes; then MODULE__ELEMENTTREE_TRUE= MODULE__ELEMENTTREE_FALSE='#' else @@ -19721,19 +19704,6 @@ else MODULE__ELEMENTTREE_FALSE= fi - -else - - if false; then - MODULE__ELEMENTTREE_TRUE= - MODULE__ELEMENTTREE_FALSE='#' -else - MODULE__ELEMENTTREE_TRUE='#' - MODULE__ELEMENTTREE_FALSE= -fi - - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__elementtree" >&5 $as_echo "$py_cv_module__elementtree" >&6; } @@ -19762,9 +19732,11 @@ esac as_fn_append MODULE_BLOCK "MODULE__MD5=$py_cv_module__md5$as_nl" if test "x$py_cv_module__md5" = xyes; then : - as_fn_append MODULE_BLOCK "MODULE__MD5_CFLAGS=$as_nl" - as_fn_append MODULE_BLOCK "MODULE__MD5_LDFLAGS=$as_nl" - if true; then + + + +fi + if test "$py_cv_module__md5" = yes; then MODULE__MD5_TRUE= MODULE__MD5_FALSE='#' else @@ -19772,19 +19744,6 @@ else MODULE__MD5_FALSE= fi - -else - - if false; then - MODULE__MD5_TRUE= - MODULE__MD5_FALSE='#' -else - MODULE__MD5_TRUE='#' - MODULE__MD5_FALSE= -fi - - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__md5" >&5 $as_echo "$py_cv_module__md5" >&6; } @@ -19812,9 +19771,11 @@ esac as_fn_append MODULE_BLOCK "MODULE__SHA1=$py_cv_module__sha1$as_nl" if test "x$py_cv_module__sha1" = xyes; then : - as_fn_append MODULE_BLOCK "MODULE__SHA1_CFLAGS=$as_nl" - as_fn_append MODULE_BLOCK "MODULE__SHA1_LDFLAGS=$as_nl" - if true; then + + + +fi + if test "$py_cv_module__sha1" = yes; then MODULE__SHA1_TRUE= MODULE__SHA1_FALSE='#' else @@ -19822,19 +19783,6 @@ else MODULE__SHA1_FALSE= fi - -else - - if false; then - MODULE__SHA1_TRUE= - MODULE__SHA1_FALSE='#' -else - MODULE__SHA1_TRUE='#' - MODULE__SHA1_FALSE= -fi - - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha1" >&5 $as_echo "$py_cv_module__sha1" >&6; } @@ -19862,9 +19810,11 @@ esac as_fn_append MODULE_BLOCK "MODULE__SHA256=$py_cv_module__sha256$as_nl" if test "x$py_cv_module__sha256" = xyes; then : - as_fn_append MODULE_BLOCK "MODULE__SHA256_CFLAGS=$as_nl" - as_fn_append MODULE_BLOCK "MODULE__SHA256_LDFLAGS=$as_nl" - if true; then + + + +fi + if test "$py_cv_module__sha256" = yes; then MODULE__SHA256_TRUE= MODULE__SHA256_FALSE='#' else @@ -19872,19 +19822,6 @@ else MODULE__SHA256_FALSE= fi - -else - - if false; then - MODULE__SHA256_TRUE= - MODULE__SHA256_FALSE='#' -else - MODULE__SHA256_TRUE='#' - MODULE__SHA256_FALSE= -fi - - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha256" >&5 $as_echo "$py_cv_module__sha256" >&6; } @@ -19912,9 +19849,11 @@ esac as_fn_append MODULE_BLOCK "MODULE__SHA512=$py_cv_module__sha512$as_nl" if test "x$py_cv_module__sha512" = xyes; then : - as_fn_append MODULE_BLOCK "MODULE__SHA512_CFLAGS=$as_nl" - as_fn_append MODULE_BLOCK "MODULE__SHA512_LDFLAGS=$as_nl" - if true; then + + + +fi + if test "$py_cv_module__sha512" = yes; then MODULE__SHA512_TRUE= MODULE__SHA512_FALSE='#' else @@ -19922,19 +19861,6 @@ else MODULE__SHA512_FALSE= fi - -else - - if false; then - MODULE__SHA512_TRUE= - MODULE__SHA512_FALSE='#' -else - MODULE__SHA512_TRUE='#' - MODULE__SHA512_FALSE= -fi - - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha512" >&5 $as_echo "$py_cv_module__sha512" >&6; } @@ -19962,9 +19888,11 @@ esac as_fn_append MODULE_BLOCK "MODULE__SHA3=$py_cv_module__sha3$as_nl" if test "x$py_cv_module__sha3" = xyes; then : - as_fn_append MODULE_BLOCK "MODULE__SHA3_CFLAGS=$as_nl" - as_fn_append MODULE_BLOCK "MODULE__SHA3_LDFLAGS=$as_nl" - if true; then + + + +fi + if test "$py_cv_module__sha3" = yes; then MODULE__SHA3_TRUE= MODULE__SHA3_FALSE='#' else @@ -19972,19 +19900,6 @@ else MODULE__SHA3_FALSE= fi - -else - - if false; then - MODULE__SHA3_TRUE= - MODULE__SHA3_FALSE='#' -else - MODULE__SHA3_TRUE='#' - MODULE__SHA3_FALSE= -fi - - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha3" >&5 $as_echo "$py_cv_module__sha3" >&6; } @@ -20012,9 +19927,11 @@ esac as_fn_append MODULE_BLOCK "MODULE__BLAKE2=$py_cv_module__blake2$as_nl" if test "x$py_cv_module__blake2" = xyes; then : - as_fn_append MODULE_BLOCK "MODULE__BLAKE2_CFLAGS=$as_nl" - as_fn_append MODULE_BLOCK "MODULE__BLAKE2_LDFLAGS=$as_nl" - if true; then + + + +fi + if test "$py_cv_module__blake2" = yes; then MODULE__BLAKE2_TRUE= MODULE__BLAKE2_FALSE='#' else @@ -20022,19 +19939,6 @@ else MODULE__BLAKE2_FALSE= fi - -else - - if false; then - MODULE__BLAKE2_TRUE= - MODULE__BLAKE2_FALSE='#' -else - MODULE__BLAKE2_TRUE='#' - MODULE__BLAKE2_FALSE= -fi - - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__blake2" >&5 $as_echo "$py_cv_module__blake2" >&6; } @@ -20065,7 +19969,9 @@ esac as_fn_append MODULE_BLOCK "MODULE__DECIMAL_CFLAGS=$LIBMPDEC_CFLAGS$as_nl" as_fn_append MODULE_BLOCK "MODULE__DECIMAL_LDFLAGS=$LIBMPDEC_LDFLAGS$as_nl" - if true; then + +fi + if test "$py_cv_module__decimal" = yes; then MODULE__DECIMAL_TRUE= MODULE__DECIMAL_FALSE='#' else @@ -20073,19 +19979,6 @@ else MODULE__DECIMAL_FALSE= fi - -else - - if false; then - MODULE__DECIMAL_TRUE= - MODULE__DECIMAL_FALSE='#' -else - MODULE__DECIMAL_TRUE='#' - MODULE__DECIMAL_FALSE= -fi - - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__decimal" >&5 $as_echo "$py_cv_module__decimal" >&6; } @@ -20115,7 +20008,9 @@ esac as_fn_append MODULE_BLOCK "MODULE__SQLITE3_CFLAGS=$LIBSQLITE3_CFLAGS$as_nl" as_fn_append MODULE_BLOCK "MODULE__SQLITE3_LDFLAGS=$LIBSQLITE3_LIBS$as_nl" - if true; then + +fi + if test "$py_cv_module__sqlite3" = yes; then MODULE__SQLITE3_TRUE= MODULE__SQLITE3_FALSE='#' else @@ -20123,23 +20018,284 @@ else MODULE__SQLITE3_FALSE= fi - -else - - if false; then - MODULE__SQLITE3_TRUE= - MODULE__SQLITE3_FALSE='#' -else - MODULE__SQLITE3_TRUE='#' - MODULE__SQLITE3_FALSE= -fi - - -fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sqlite3" >&5 $as_echo "$py_cv_module__sqlite3" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testcapi" >&5 +$as_echo_n "checking for stdlib extension module _testcapi... " >&6; } + case $py_stdlib_not_available in #( + *_testcapi*) : + py_cv_module__testcapi=n/a ;; #( + *) : + + if test "$TEST_MODULES" = yes; then : + if true; then : + py_cv_module__testcapi=yes +else + py_cv_module__testcapi=missing +fi +else + py_cv_module__testcapi=disabled + +fi + + ;; +esac + as_fn_append MODULE_BLOCK "MODULE__TESTCAPI=$py_cv_module__testcapi$as_nl" + if test "x$py_cv_module__testcapi" = xyes; then : + + + + +fi + if test "$py_cv_module__testcapi" = yes; then + MODULE__TESTCAPI_TRUE= + MODULE__TESTCAPI_FALSE='#' +else + MODULE__TESTCAPI_TRUE='#' + MODULE__TESTCAPI_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__testcapi" >&5 +$as_echo "$py_cv_module__testcapi" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testinternalcapi" >&5 +$as_echo_n "checking for stdlib extension module _testinternalcapi... " >&6; } + case $py_stdlib_not_available in #( + *_testinternalcapi*) : + py_cv_module__testinternalcapi=n/a ;; #( + *) : + + if test "$TEST_MODULES" = yes; then : + if true; then : + py_cv_module__testinternalcapi=yes +else + py_cv_module__testinternalcapi=missing +fi +else + py_cv_module__testinternalcapi=disabled + +fi + + ;; +esac + as_fn_append MODULE_BLOCK "MODULE__TESTINTERNALCAPI=$py_cv_module__testinternalcapi$as_nl" + if test "x$py_cv_module__testinternalcapi" = xyes; then : + + + + +fi + if test "$py_cv_module__testinternalcapi" = yes; then + MODULE__TESTINTERNALCAPI_TRUE= + MODULE__TESTINTERNALCAPI_FALSE='#' +else + MODULE__TESTINTERNALCAPI_TRUE='#' + MODULE__TESTINTERNALCAPI_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__testinternalcapi" >&5 +$as_echo "$py_cv_module__testinternalcapi" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testbuffer" >&5 +$as_echo_n "checking for stdlib extension module _testbuffer... " >&6; } + case $py_stdlib_not_available in #( + *_testbuffer*) : + py_cv_module__testbuffer=n/a ;; #( + *) : + + if test "$TEST_MODULES" = yes; then : + if true; then : + py_cv_module__testbuffer=yes +else + py_cv_module__testbuffer=missing +fi +else + py_cv_module__testbuffer=disabled + +fi + + ;; +esac + as_fn_append MODULE_BLOCK "MODULE__TESTBUFFER=$py_cv_module__testbuffer$as_nl" + if test "x$py_cv_module__testbuffer" = xyes; then : + + + + +fi + if test "$py_cv_module__testbuffer" = yes; then + MODULE__TESTBUFFER_TRUE= + MODULE__TESTBUFFER_FALSE='#' +else + MODULE__TESTBUFFER_TRUE='#' + MODULE__TESTBUFFER_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__testbuffer" >&5 +$as_echo "$py_cv_module__testbuffer" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testimportmultiple" >&5 +$as_echo_n "checking for stdlib extension module _testimportmultiple... " >&6; } + case $py_stdlib_not_available in #( + *_testimportmultiple*) : + py_cv_module__testimportmultiple=n/a ;; #( + *) : + + if test "$TEST_MODULES" = yes; then : + if true; then : + py_cv_module__testimportmultiple=yes +else + py_cv_module__testimportmultiple=missing +fi +else + py_cv_module__testimportmultiple=disabled + +fi + + ;; +esac + as_fn_append MODULE_BLOCK "MODULE__TESTIMPORTMULTIPLE=$py_cv_module__testimportmultiple$as_nl" + if test "x$py_cv_module__testimportmultiple" = xyes; then : + + + + +fi + if test "$py_cv_module__testimportmultiple" = yes; then + MODULE__TESTIMPORTMULTIPLE_TRUE= + MODULE__TESTIMPORTMULTIPLE_FALSE='#' +else + MODULE__TESTIMPORTMULTIPLE_TRUE='#' + MODULE__TESTIMPORTMULTIPLE_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__testimportmultiple" >&5 +$as_echo "$py_cv_module__testimportmultiple" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testmultiphase" >&5 +$as_echo_n "checking for stdlib extension module _testmultiphase... " >&6; } + case $py_stdlib_not_available in #( + *_testmultiphase*) : + py_cv_module__testmultiphase=n/a ;; #( + *) : + + if test "$TEST_MODULES" = yes; then : + if true; then : + py_cv_module__testmultiphase=yes +else + py_cv_module__testmultiphase=missing +fi +else + py_cv_module__testmultiphase=disabled + +fi + + ;; +esac + as_fn_append MODULE_BLOCK "MODULE__TESTMULTIPHASE=$py_cv_module__testmultiphase$as_nl" + if test "x$py_cv_module__testmultiphase" = xyes; then : + + + + +fi + if test "$py_cv_module__testmultiphase" = yes; then + MODULE__TESTMULTIPHASE_TRUE= + MODULE__TESTMULTIPHASE_FALSE='#' +else + MODULE__TESTMULTIPHASE_TRUE='#' + MODULE__TESTMULTIPHASE_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__testmultiphase" >&5 +$as_echo "$py_cv_module__testmultiphase" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _xxtestfuzz" >&5 +$as_echo_n "checking for stdlib extension module _xxtestfuzz... " >&6; } + case $py_stdlib_not_available in #( + *_xxtestfuzz*) : + py_cv_module__xxtestfuzz=n/a ;; #( + *) : + + if test "$TEST_MODULES" = yes; then : + if true; then : + py_cv_module__xxtestfuzz=yes +else + py_cv_module__xxtestfuzz=missing +fi +else + py_cv_module__xxtestfuzz=disabled + +fi + + ;; +esac + as_fn_append MODULE_BLOCK "MODULE__XXTESTFUZZ=$py_cv_module__xxtestfuzz$as_nl" + if test "x$py_cv_module__xxtestfuzz" = xyes; then : + + + + +fi + if test "$py_cv_module__xxtestfuzz" = yes; then + MODULE__XXTESTFUZZ_TRUE= + MODULE__XXTESTFUZZ_FALSE='#' +else + MODULE__XXTESTFUZZ_TRUE='#' + MODULE__XXTESTFUZZ_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__xxtestfuzz" >&5 +$as_echo "$py_cv_module__xxtestfuzz" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _ctypes_test" >&5 +$as_echo_n "checking for stdlib extension module _ctypes_test... " >&6; } + case $py_stdlib_not_available in #( + *_ctypes_test*) : + py_cv_module__ctypes_test=n/a ;; #( + *) : + + if test "$TEST_MODULES" = yes; then : + if true; then : + py_cv_module__ctypes_test=yes +else + py_cv_module__ctypes_test=missing +fi +else + py_cv_module__ctypes_test=disabled + +fi + + ;; +esac + as_fn_append MODULE_BLOCK "MODULE__CTYPES_TEST=$py_cv_module__ctypes_test$as_nl" + if test "x$py_cv_module__ctypes_test" = xyes; then : + + + as_fn_append MODULE_BLOCK "MODULE__CTYPES_TEST_LDFLAGS=-lm$as_nl" + +fi + if test "$py_cv_module__ctypes_test" = yes; then + MODULE__CTYPES_TEST_TRUE= + MODULE__CTYPES_TEST_FALSE='#' +else + MODULE__CTYPES_TEST_TRUE='#' + MODULE__CTYPES_TEST_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__ctypes_test" >&5 +$as_echo "$py_cv_module__ctypes_test" >&6; } + + # substitute multiline block, must come after last PY_STDLIB_MOD() @@ -20276,22 +20432,10 @@ if test -z "${MODULE_OSSAUDIODEV_TRUE}" && test -z "${MODULE_OSSAUDIODEV_FALSE}" as_fn_error $? "conditional \"MODULE_OSSAUDIODEV\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${MODULE_OSSAUDIODEV_TRUE}" && test -z "${MODULE_OSSAUDIODEV_FALSE}"; then - as_fn_error $? "conditional \"MODULE_OSSAUDIODEV\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${MODULE__SCPROXY_TRUE}" && test -z "${MODULE__SCPROXY_FALSE}"; then as_fn_error $? "conditional \"MODULE__SCPROXY\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${MODULE__SCPROXY_TRUE}" && test -z "${MODULE__SCPROXY_FALSE}"; then - as_fn_error $? "conditional \"MODULE__SCPROXY\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${MODULE_PYEXPAT_TRUE}" && test -z "${MODULE_PYEXPAT_FALSE}"; then - as_fn_error $? "conditional \"MODULE_PYEXPAT\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${MODULE_PYEXPAT_TRUE}" && test -z "${MODULE_PYEXPAT_FALSE}"; then as_fn_error $? "conditional \"MODULE_PYEXPAT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -20300,22 +20444,10 @@ if test -z "${MODULE__ELEMENTTREE_TRUE}" && test -z "${MODULE__ELEMENTTREE_FALSE as_fn_error $? "conditional \"MODULE__ELEMENTTREE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${MODULE__ELEMENTTREE_TRUE}" && test -z "${MODULE__ELEMENTTREE_FALSE}"; then - as_fn_error $? "conditional \"MODULE__ELEMENTTREE\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${MODULE__MD5_TRUE}" && test -z "${MODULE__MD5_FALSE}"; then as_fn_error $? "conditional \"MODULE__MD5\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${MODULE__MD5_TRUE}" && test -z "${MODULE__MD5_FALSE}"; then - as_fn_error $? "conditional \"MODULE__MD5\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${MODULE__SHA1_TRUE}" && test -z "${MODULE__SHA1_FALSE}"; then - as_fn_error $? "conditional \"MODULE__SHA1\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${MODULE__SHA1_TRUE}" && test -z "${MODULE__SHA1_FALSE}"; then as_fn_error $? "conditional \"MODULE__SHA1\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -20324,22 +20456,10 @@ if test -z "${MODULE__SHA256_TRUE}" && test -z "${MODULE__SHA256_FALSE}"; then as_fn_error $? "conditional \"MODULE__SHA256\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${MODULE__SHA256_TRUE}" && test -z "${MODULE__SHA256_FALSE}"; then - as_fn_error $? "conditional \"MODULE__SHA256\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${MODULE__SHA512_TRUE}" && test -z "${MODULE__SHA512_FALSE}"; then as_fn_error $? "conditional \"MODULE__SHA512\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${MODULE__SHA512_TRUE}" && test -z "${MODULE__SHA512_FALSE}"; then - as_fn_error $? "conditional \"MODULE__SHA512\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${MODULE__SHA3_TRUE}" && test -z "${MODULE__SHA3_FALSE}"; then - as_fn_error $? "conditional \"MODULE__SHA3\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${MODULE__SHA3_TRUE}" && test -z "${MODULE__SHA3_FALSE}"; then as_fn_error $? "conditional \"MODULE__SHA3\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -20348,14 +20468,6 @@ if test -z "${MODULE__BLAKE2_TRUE}" && test -z "${MODULE__BLAKE2_FALSE}"; then as_fn_error $? "conditional \"MODULE__BLAKE2\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${MODULE__BLAKE2_TRUE}" && test -z "${MODULE__BLAKE2_FALSE}"; then - as_fn_error $? "conditional \"MODULE__BLAKE2\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${MODULE__DECIMAL_TRUE}" && test -z "${MODULE__DECIMAL_FALSE}"; then - as_fn_error $? "conditional \"MODULE__DECIMAL\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${MODULE__DECIMAL_TRUE}" && test -z "${MODULE__DECIMAL_FALSE}"; then as_fn_error $? "conditional \"MODULE__DECIMAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -20364,8 +20476,32 @@ if test -z "${MODULE__SQLITE3_TRUE}" && test -z "${MODULE__SQLITE3_FALSE}"; then as_fn_error $? "conditional \"MODULE__SQLITE3\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${MODULE__SQLITE3_TRUE}" && test -z "${MODULE__SQLITE3_FALSE}"; then - as_fn_error $? "conditional \"MODULE__SQLITE3\" was never defined. +if test -z "${MODULE__TESTCAPI_TRUE}" && test -z "${MODULE__TESTCAPI_FALSE}"; then + as_fn_error $? "conditional \"MODULE__TESTCAPI\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MODULE__TESTINTERNALCAPI_TRUE}" && test -z "${MODULE__TESTINTERNALCAPI_FALSE}"; then + as_fn_error $? "conditional \"MODULE__TESTINTERNALCAPI\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MODULE__TESTBUFFER_TRUE}" && test -z "${MODULE__TESTBUFFER_FALSE}"; then + as_fn_error $? "conditional \"MODULE__TESTBUFFER\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MODULE__TESTIMPORTMULTIPLE_TRUE}" && test -z "${MODULE__TESTIMPORTMULTIPLE_FALSE}"; then + as_fn_error $? "conditional \"MODULE__TESTIMPORTMULTIPLE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MODULE__TESTMULTIPHASE_TRUE}" && test -z "${MODULE__TESTMULTIPHASE_FALSE}"; then + as_fn_error $? "conditional \"MODULE__TESTMULTIPHASE\" 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 + as_fn_error $? "conditional \"MODULE__XXTESTFUZZ\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MODULE__CTYPES_TEST_TRUE}" && test -z "${MODULE__CTYPES_TEST_FALSE}"; then + as_fn_error $? "conditional \"MODULE__CTYPES_TEST\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi diff --git a/configure.ac b/configure.ac index f4adab19d61..6c24a278595 100644 --- a/configure.ac +++ b/configure.ac @@ -6028,12 +6028,10 @@ AC_DEFUN([PY_STDLIB_MOD], [ ) _MODULE_BLOCK_ADD(modcond, [$modstate]) AS_VAR_IF([modstate], [yes], [ - _MODULE_BLOCK_ADD([MODULE_]m4_toupper([$1])[_CFLAGS], [$4]) - _MODULE_BLOCK_ADD([MODULE_]m4_toupper([$1])[_LDFLAGS], [$5]) - AM_CONDITIONAL(modcond, [true]) - ], [ - AM_CONDITIONAL(modcond, [false]) + m4_ifblank([$4], [], [_MODULE_BLOCK_ADD([MODULE_]m4_toupper([$1])[_CFLAGS], [$4])]) + m4_ifblank([$5], [], [_MODULE_BLOCK_ADD([MODULE_]m4_toupper([$1])[_LDFLAGS], [$5])]) ]) + AM_CONDITIONAL(modcond, [test "$modstate" = yes]) AC_MSG_RESULT([$modstate]) m4_popdef([modcond])dnl m4_popdef([modstate])dnl @@ -6087,6 +6085,15 @@ PY_STDLIB_MOD([_sqlite3], [test "$have_supported_sqlite3" = "yes"], [$LIBSQLITE3_CFLAGS], [$LIBSQLITE3_LIBS]) +dnl test modules +PY_STDLIB_MOD([_testcapi], [test "$TEST_MODULES" = yes]) +PY_STDLIB_MOD([_testinternalcapi], [test "$TEST_MODULES" = yes]) +PY_STDLIB_MOD([_testbuffer], [test "$TEST_MODULES" = yes]) +PY_STDLIB_MOD([_testimportmultiple], [test "$TEST_MODULES" = yes]) +PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes]) +PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes]) +PY_STDLIB_MOD([_ctypes_test], [test "$TEST_MODULES" = yes], [], [], [-lm]) + # substitute multiline block, must come after last PY_STDLIB_MOD() AC_SUBST([MODULE_BLOCK]) diff --git a/setup.py b/setup.py index 83a676bfefb..d01cc4f7169 100644 --- a/setup.py +++ b/setup.py @@ -55,9 +55,6 @@ with warnings.catch_warnings(): from distutils.spawn import find_executable -# Compile extensions used to test Python? -TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes') - # This global variable is used to hold the list of modules to be disabled. DISABLED_MODULE_LIST = [] @@ -1098,24 +1095,25 @@ class PyBuildExt(build_ext): def detect_test_extensions(self): # Python C API test module - self.add(Extension('_testcapi', ['_testcapimodule.c'])) + self.addext(Extension('_testcapi', ['_testcapimodule.c'])) # Python Internal C API test module - self.add(Extension('_testinternalcapi', ['_testinternalcapi.c'])) + self.addext(Extension('_testinternalcapi', ['_testinternalcapi.c'])) # Python PEP-3118 (buffer protocol) test module - self.add(Extension('_testbuffer', ['_testbuffer.c'])) + self.addext(Extension('_testbuffer', ['_testbuffer.c'])) # Test loading multiple modules from one compiled file (https://bugs.python.org/issue16421) - self.add(Extension('_testimportmultiple', ['_testimportmultiple.c'])) + self.addext(Extension('_testimportmultiple', ['_testimportmultiple.c'])) # Test multi-phase extension module init (PEP 489) - self.add(Extension('_testmultiphase', ['_testmultiphase.c'])) + self.addext(Extension('_testmultiphase', ['_testmultiphase.c'])) # Fuzz tests. - self.add(Extension('_xxtestfuzz', - ['_xxtestfuzz/_xxtestfuzz.c', - '_xxtestfuzz/fuzzer.c'])) + self.addext(Extension( + '_xxtestfuzz', + ['_xxtestfuzz/_xxtestfuzz.c', '_xxtestfuzz/fuzzer.c'] + )) def detect_readline_curses(self): # readline @@ -1503,8 +1501,7 @@ class PyBuildExt(build_ext): # These are extensions are required to bootstrap the interpreter or # build process. self.detect_simple_extensions() - if TEST_EXTENSIONS: - self.detect_test_extensions() + self.detect_test_extensions() self.detect_readline_curses() self.detect_crypt() self.detect_socket() @@ -1883,11 +1880,8 @@ class PyBuildExt(build_ext): libraries=[], sources=sources) self.add(ext) - if TEST_EXTENSIONS: - # function my_sqrt() needs libm for sqrt() - self.add(Extension('_ctypes_test', - sources=['_ctypes/_ctypes_test.c'], - libraries=['m'])) + # function my_sqrt() needs libm for sqrt() + self.addext(Extension('_ctypes_test', ['_ctypes/_ctypes_test.c'])) ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR") ffi_lib = None