bpo-45847: Port mmap, select, and _xxsubinterpreters to Py_STDLIB_MOD (GH-29703)

This commit is contained in:
Erlend Egeberg Aasland 2021-11-22 14:49:58 +01:00 committed by GitHub
parent d3062f672c
commit b451673f93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 83 additions and 4 deletions

View File

@ -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

72
configure vendored
View File

@ -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
@ -19687,6 +19693,15 @@ else
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='#'
@ -19696,6 +19711,15 @@ else
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='#'
@ -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

View File

@ -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])

View File

@ -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