From b451673f93465a27ee61e408190ee61cb9dbd5b6 Mon Sep 17 00:00:00 2001 From: Erlend Egeberg Aasland Date: Mon, 22 Nov 2021 14:49:58 +0100 Subject: bpo-45847: Port mmap, select, and _xxsubinterpreters to Py_STDLIB_MOD (GH-29703) --- Modules/Setup.stdlib.in | 3 +++ configure | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 6 ++++- setup.py | 6 ++--- 4 files changed, 83 insertions(+), 4 deletions(-) diff --git a/Modules/Setup.stdlib.in b/Modules/Setup.stdlib.in index e1ddc13..339a324 100644 --- a/Modules/Setup.stdlib.in +++ b/Modules/Setup.stdlib.in @@ -40,6 +40,7 @@ @MODULE__QUEUE_TRUE@_queue _queuemodule.c @MODULE__RANDOM_TRUE@_random _randommodule.c @MODULE__TYPING_TRUE@_typing _typingmodule.c +@MODULE__XXSUBINTERPRETERS_TRUE@_xxsubinterpreters __xxsubinterpretersmodule.c @MODULE__ZONEINFO_TRUE@_zoneinfo _zoneinfo.c # needs libm @@ -89,9 +90,11 @@ @MODULE_FCNTL_TRUE@fcntl fcntlmodule.c @MODULE_GRP_TRUE@grp grpmodule.c +@MODULE_MMAP_TRUE@mmap mmapmodule.c # needs sys/soundcard.h or linux/soundcard.h (Linux, FreeBSD) @MODULE_OSSAUDIODEV_TRUE@ossaudiodev ossaudiodev.c @MODULE_RESOURCE_TRUE@resource resource.c +@MODULE_SELECT_TRUE@select selectmodule.c # AIX has shadow passwords, but does not provide getspent API @MODULE_SPWD_TRUE@spwd spwdmodule.c @MODULE_SYSLOG_TRUE@syslog syslogmodule.c diff --git a/configure b/configure index c725d0f..f3c3361 100755 --- a/configure +++ b/configure @@ -688,6 +688,8 @@ MODULE_OSSAUDIODEV_FALSE MODULE_OSSAUDIODEV_TRUE MODULE_GRP_FALSE MODULE_GRP_TRUE +MODULE_MMAP_FALSE +MODULE_MMAP_TRUE MODULE_FCNTL_FALSE MODULE_FCNTL_TRUE MODULE__DATETIME_FALSE @@ -700,8 +702,12 @@ MODULE__STATISTICS_FALSE MODULE__STATISTICS_TRUE MODULE__ZONEINFO_FALSE MODULE__ZONEINFO_TRUE +MODULE__XXSUBINTERPRETERS_FALSE +MODULE__XXSUBINTERPRETERS_TRUE MODULE__TYPING_FALSE MODULE__TYPING_TRUE +MODULE_SELECT_FALSE +MODULE_SELECT_TRUE MODULE__RANDOM_FALSE MODULE__RANDOM_TRUE MODULE__QUEUE_FALSE @@ -19688,6 +19694,15 @@ fi as_fn_append MODULE_BLOCK "MODULE__RANDOM=yes$as_nl" if true; then + MODULE_SELECT_TRUE= + MODULE_SELECT_FALSE='#' +else + MODULE_SELECT_TRUE='#' + MODULE_SELECT_FALSE= +fi + as_fn_append MODULE_BLOCK "MODULE_SELECT=yes$as_nl" + + if true; then MODULE__TYPING_TRUE= MODULE__TYPING_FALSE='#' else @@ -19697,6 +19712,15 @@ fi as_fn_append MODULE_BLOCK "MODULE__TYPING=yes$as_nl" if true; then + MODULE__XXSUBINTERPRETERS_TRUE= + MODULE__XXSUBINTERPRETERS_FALSE='#' +else + MODULE__XXSUBINTERPRETERS_TRUE='#' + MODULE__XXSUBINTERPRETERS_FALSE= +fi + as_fn_append MODULE_BLOCK "MODULE__XXSUBINTERPRETERS=yes$as_nl" + + if true; then MODULE__ZONEINFO_TRUE= MODULE__ZONEINFO_FALSE='#' else @@ -19788,6 +19812,42 @@ fi $as_echo "$py_cv_module_fcntl" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module mmap" >&5 +$as_echo_n "checking for stdlib extension module mmap... " >&6; } + case $py_stdlib_not_available in #( + *mmap*) : + py_cv_module_mmap=n/a ;; #( + *) : + if true; then : + if test "$ac_cv_header_sys_mman_h" = "yes" -a "$ac_cv_header_sys_stat_h" = "yes"; then : + py_cv_module_mmap=yes +else + py_cv_module_mmap=missing +fi +else + py_cv_module_mmap=disabled +fi + ;; +esac + as_fn_append MODULE_BLOCK "MODULE_MMAP=$py_cv_module_mmap$as_nl" + if test "x$py_cv_module_mmap" = xyes; then : + + + + +fi + if test "$py_cv_module_mmap" = yes; then + MODULE_MMAP_TRUE= + MODULE_MMAP_FALSE='#' +else + MODULE_MMAP_TRUE='#' + MODULE_MMAP_FALSE= +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_mmap" >&5 +$as_echo "$py_cv_module_mmap" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module grp" >&5 $as_echo_n "checking for stdlib extension module grp... " >&6; } @@ -20901,10 +20961,18 @@ if test -z "${MODULE__RANDOM_TRUE}" && test -z "${MODULE__RANDOM_FALSE}"; then as_fn_error $? "conditional \"MODULE__RANDOM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${MODULE_SELECT_TRUE}" && test -z "${MODULE_SELECT_FALSE}"; then + as_fn_error $? "conditional \"MODULE_SELECT\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MODULE__TYPING_TRUE}" && test -z "${MODULE__TYPING_FALSE}"; then as_fn_error $? "conditional \"MODULE__TYPING\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${MODULE__XXSUBINTERPRETERS_TRUE}" && test -z "${MODULE__XXSUBINTERPRETERS_FALSE}"; then + as_fn_error $? "conditional \"MODULE__XXSUBINTERPRETERS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MODULE__ZONEINFO_TRUE}" && test -z "${MODULE__ZONEINFO_FALSE}"; then as_fn_error $? "conditional \"MODULE__ZONEINFO\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -20929,6 +20997,10 @@ if test -z "${MODULE_FCNTL_TRUE}" && test -z "${MODULE_FCNTL_FALSE}"; then as_fn_error $? "conditional \"MODULE_FCNTL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${MODULE_MMAP_TRUE}" && test -z "${MODULE_MMAP_FALSE}"; then + as_fn_error $? "conditional \"MODULE_MMAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${MODULE_GRP_TRUE}" && test -z "${MODULE_GRP_FALSE}"; then as_fn_error $? "conditional \"MODULE_GRP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 25d210b..224a9b9 100644 --- a/configure.ac +++ b/configure.ac @@ -6081,7 +6081,9 @@ PY_STDLIB_MOD_SIMPLE([_opcode]) PY_STDLIB_MOD_SIMPLE([_pickle]) PY_STDLIB_MOD_SIMPLE([_queue]) PY_STDLIB_MOD_SIMPLE([_random]) +PY_STDLIB_MOD_SIMPLE([select]) PY_STDLIB_MOD_SIMPLE([_typing]) +PY_STDLIB_MOD_SIMPLE([_xxsubinterpreters]) PY_STDLIB_MOD_SIMPLE([_zoneinfo]) dnl needs libm @@ -6092,10 +6094,12 @@ PY_STDLIB_MOD_SIMPLE([math], [], [$LIBM]) dnl needs libm and on some platforms librt PY_STDLIB_MOD_SIMPLE([_datetime], [], [$TIMEMODULE_LIB $LIBM]) -dnl needs libbsd on some platforms +dnl modules with some unix dependencies PY_STDLIB_MOD([fcntl], [], [test "$ac_cv_header_sys_ioctl_h" = "yes" -a "$ac_cv_header_fcntl_h" = "yes"], [], [$FCNTL_LIBS]) +PY_STDLIB_MOD([mmap], + [], [test "$ac_cv_header_sys_mman_h" = "yes" -a "$ac_cv_header_sys_stat_h" = "yes"]) dnl platform specific extensions PY_STDLIB_MOD([grp], [], [test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes]) diff --git a/setup.py b/setup.py index 28fd6da..d4eff36 100644 --- a/setup.py +++ b/setup.py @@ -1036,17 +1036,17 @@ class PyBuildExt(build_ext): self.addext(Extension('spwd', ['spwdmodule.c'])) # select(2); not on ancient System V - self.add(Extension('select', ['selectmodule.c'])) + self.addext(Extension('select', ['selectmodule.c'])) # Memory-mapped files (also works on Win32). - self.add(Extension('mmap', ['mmapmodule.c'])) + self.addext(Extension('mmap', ['mmapmodule.c'])) # Lance Ellinghaus's syslog module # syslog daemon interface self.addext(Extension('syslog', ['syslogmodule.c'])) # Python interface to subinterpreter C-API. - self.add(Extension('_xxsubinterpreters', ['_xxsubinterpretersmodule.c'])) + self.addext(Extension('_xxsubinterpreters', ['_xxsubinterpretersmodule.c'])) # # Here ends the simple stuff. From here on, modules need certain -- cgit v0.12