Skip to content

Commit b451673

Browse files
author
Erlend Egeberg Aasland
authored
bpo-45847: Port mmap, select, and _xxsubinterpreters to Py_STDLIB_MOD (GH-29703)
1 parent d3062f6 commit b451673

File tree

4 files changed

+83
-4
lines changed

4 files changed

+83
-4
lines changed

Modules/Setup.stdlib.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
@MODULE__QUEUE_TRUE@_queue _queuemodule.c
4141
@MODULE__RANDOM_TRUE@_random _randommodule.c
4242
@MODULE__TYPING_TRUE@_typing _typingmodule.c
43+
@MODULE__XXSUBINTERPRETERS_TRUE@_xxsubinterpreters __xxsubinterpretersmodule.c
4344
@MODULE__ZONEINFO_TRUE@_zoneinfo _zoneinfo.c
4445

4546
# needs libm
@@ -89,9 +90,11 @@
8990

9091
@MODULE_FCNTL_TRUE@fcntl fcntlmodule.c
9192
@MODULE_GRP_TRUE@grp grpmodule.c
93+
@MODULE_MMAP_TRUE@mmap mmapmodule.c
9294
# needs sys/soundcard.h or linux/soundcard.h (Linux, FreeBSD)
9395
@MODULE_OSSAUDIODEV_TRUE@ossaudiodev ossaudiodev.c
9496
@MODULE_RESOURCE_TRUE@resource resource.c
97+
@MODULE_SELECT_TRUE@select selectmodule.c
9598
# AIX has shadow passwords, but does not provide getspent API
9699
@MODULE_SPWD_TRUE@spwd spwdmodule.c
97100
@MODULE_SYSLOG_TRUE@syslog syslogmodule.c

configure

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,8 @@ MODULE_OSSAUDIODEV_FALSE
688688
MODULE_OSSAUDIODEV_TRUE
689689
MODULE_GRP_FALSE
690690
MODULE_GRP_TRUE
691+
MODULE_MMAP_FALSE
692+
MODULE_MMAP_TRUE
691693
MODULE_FCNTL_FALSE
692694
MODULE_FCNTL_TRUE
693695
MODULE__DATETIME_FALSE
@@ -700,8 +702,12 @@ MODULE__STATISTICS_FALSE
700702
MODULE__STATISTICS_TRUE
701703
MODULE__ZONEINFO_FALSE
702704
MODULE__ZONEINFO_TRUE
705+
MODULE__XXSUBINTERPRETERS_FALSE
706+
MODULE__XXSUBINTERPRETERS_TRUE
703707
MODULE__TYPING_FALSE
704708
MODULE__TYPING_TRUE
709+
MODULE_SELECT_FALSE
710+
MODULE_SELECT_TRUE
705711
MODULE__RANDOM_FALSE
706712
MODULE__RANDOM_TRUE
707713
MODULE__QUEUE_FALSE
@@ -19687,6 +19693,15 @@ else
1968719693
fi
1968819694
as_fn_append MODULE_BLOCK "MODULE__RANDOM=yes$as_nl"
1968919695

19696+
if true; then
19697+
MODULE_SELECT_TRUE=
19698+
MODULE_SELECT_FALSE='#'
19699+
else
19700+
MODULE_SELECT_TRUE='#'
19701+
MODULE_SELECT_FALSE=
19702+
fi
19703+
as_fn_append MODULE_BLOCK "MODULE_SELECT=yes$as_nl"
19704+
1969019705
if true; then
1969119706
MODULE__TYPING_TRUE=
1969219707
MODULE__TYPING_FALSE='#'
@@ -19696,6 +19711,15 @@ else
1969619711
fi
1969719712
as_fn_append MODULE_BLOCK "MODULE__TYPING=yes$as_nl"
1969819713

19714+
if true; then
19715+
MODULE__XXSUBINTERPRETERS_TRUE=
19716+
MODULE__XXSUBINTERPRETERS_FALSE='#'
19717+
else
19718+
MODULE__XXSUBINTERPRETERS_TRUE='#'
19719+
MODULE__XXSUBINTERPRETERS_FALSE=
19720+
fi
19721+
as_fn_append MODULE_BLOCK "MODULE__XXSUBINTERPRETERS=yes$as_nl"
19722+
1969919723
if true; then
1970019724
MODULE__ZONEINFO_TRUE=
1970119725
MODULE__ZONEINFO_FALSE='#'
@@ -19788,6 +19812,42 @@ fi
1978819812
$as_echo "$py_cv_module_fcntl" >&6; }
1978919813

1979019814

19815+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module mmap" >&5
19816+
$as_echo_n "checking for stdlib extension module mmap... " >&6; }
19817+
case $py_stdlib_not_available in #(
19818+
*mmap*) :
19819+
py_cv_module_mmap=n/a ;; #(
19820+
*) :
19821+
if true; then :
19822+
if test "$ac_cv_header_sys_mman_h" = "yes" -a "$ac_cv_header_sys_stat_h" = "yes"; then :
19823+
py_cv_module_mmap=yes
19824+
else
19825+
py_cv_module_mmap=missing
19826+
fi
19827+
else
19828+
py_cv_module_mmap=disabled
19829+
fi
19830+
;;
19831+
esac
19832+
as_fn_append MODULE_BLOCK "MODULE_MMAP=$py_cv_module_mmap$as_nl"
19833+
if test "x$py_cv_module_mmap" = xyes; then :
19834+
19835+
19836+
19837+
19838+
fi
19839+
if test "$py_cv_module_mmap" = yes; then
19840+
MODULE_MMAP_TRUE=
19841+
MODULE_MMAP_FALSE='#'
19842+
else
19843+
MODULE_MMAP_TRUE='#'
19844+
MODULE_MMAP_FALSE=
19845+
fi
19846+
19847+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_mmap" >&5
19848+
$as_echo "$py_cv_module_mmap" >&6; }
19849+
19850+
1979119851

1979219852
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module grp" >&5
1979319853
$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
2090120961
as_fn_error $? "conditional \"MODULE__RANDOM\" was never defined.
2090220962
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2090320963
fi
20964+
if test -z "${MODULE_SELECT_TRUE}" && test -z "${MODULE_SELECT_FALSE}"; then
20965+
as_fn_error $? "conditional \"MODULE_SELECT\" was never defined.
20966+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
20967+
fi
2090420968
if test -z "${MODULE__TYPING_TRUE}" && test -z "${MODULE__TYPING_FALSE}"; then
2090520969
as_fn_error $? "conditional \"MODULE__TYPING\" was never defined.
2090620970
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2090720971
fi
20972+
if test -z "${MODULE__XXSUBINTERPRETERS_TRUE}" && test -z "${MODULE__XXSUBINTERPRETERS_FALSE}"; then
20973+
as_fn_error $? "conditional \"MODULE__XXSUBINTERPRETERS\" was never defined.
20974+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
20975+
fi
2090820976
if test -z "${MODULE__ZONEINFO_TRUE}" && test -z "${MODULE__ZONEINFO_FALSE}"; then
2090920977
as_fn_error $? "conditional \"MODULE__ZONEINFO\" was never defined.
2091020978
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
2092920997
as_fn_error $? "conditional \"MODULE_FCNTL\" was never defined.
2093020998
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2093120999
fi
21000+
if test -z "${MODULE_MMAP_TRUE}" && test -z "${MODULE_MMAP_FALSE}"; then
21001+
as_fn_error $? "conditional \"MODULE_MMAP\" was never defined.
21002+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
21003+
fi
2093221004
if test -z "${MODULE_GRP_TRUE}" && test -z "${MODULE_GRP_FALSE}"; then
2093321005
as_fn_error $? "conditional \"MODULE_GRP\" was never defined.
2093421006
Usually this means the macro was only invoked conditionally." "$LINENO" 5

configure.ac

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6081,7 +6081,9 @@ PY_STDLIB_MOD_SIMPLE([_opcode])
60816081
PY_STDLIB_MOD_SIMPLE([_pickle])
60826082
PY_STDLIB_MOD_SIMPLE([_queue])
60836083
PY_STDLIB_MOD_SIMPLE([_random])
6084+
PY_STDLIB_MOD_SIMPLE([select])
60846085
PY_STDLIB_MOD_SIMPLE([_typing])
6086+
PY_STDLIB_MOD_SIMPLE([_xxsubinterpreters])
60856087
PY_STDLIB_MOD_SIMPLE([_zoneinfo])
60866088

60876089
dnl needs libm
@@ -6092,10 +6094,12 @@ PY_STDLIB_MOD_SIMPLE([math], [], [$LIBM])
60926094
dnl needs libm and on some platforms librt
60936095
PY_STDLIB_MOD_SIMPLE([_datetime], [], [$TIMEMODULE_LIB $LIBM])
60946096

6095-
dnl needs libbsd on some platforms
6097+
dnl modules with some unix dependencies
60966098
PY_STDLIB_MOD([fcntl],
60976099
[], [test "$ac_cv_header_sys_ioctl_h" = "yes" -a "$ac_cv_header_fcntl_h" = "yes"],
60986100
[], [$FCNTL_LIBS])
6101+
PY_STDLIB_MOD([mmap],
6102+
[], [test "$ac_cv_header_sys_mman_h" = "yes" -a "$ac_cv_header_sys_stat_h" = "yes"])
60996103

61006104
dnl platform specific extensions
61016105
PY_STDLIB_MOD([grp], [], [test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes])

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,17 +1036,17 @@ def detect_simple_extensions(self):
10361036
self.addext(Extension('spwd', ['spwdmodule.c']))
10371037

10381038
# select(2); not on ancient System V
1039-
self.add(Extension('select', ['selectmodule.c']))
1039+
self.addext(Extension('select', ['selectmodule.c']))
10401040

10411041
# Memory-mapped files (also works on Win32).
1042-
self.add(Extension('mmap', ['mmapmodule.c']))
1042+
self.addext(Extension('mmap', ['mmapmodule.c']))
10431043

10441044
# Lance Ellinghaus's syslog module
10451045
# syslog daemon interface
10461046
self.addext(Extension('syslog', ['syslogmodule.c']))
10471047

10481048
# Python interface to subinterpreter C-API.
1049-
self.add(Extension('_xxsubinterpreters', ['_xxsubinterpretersmodule.c']))
1049+
self.addext(Extension('_xxsubinterpreters', ['_xxsubinterpretersmodule.c']))
10501050

10511051
#
10521052
# Here ends the simple stuff. From here on, modules need certain

0 commit comments

Comments
 (0)