Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Modules/Setup.stdlib.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
72 changes: 72 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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='#'
Expand All @@ -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='#'
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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])
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,17 +1036,17 @@ def detect_simple_extensions(self):
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
Expand Down