Skip to content

Commit f201d26

Browse files
authored
bpo-45847: Port grp, spwd, termios, resource, syslog to PY_STDLIB_MOD (GH-29668)
1 parent 4f006a7 commit f201d26

File tree

5 files changed

+254
-25
lines changed

5 files changed

+254
-25
lines changed

Diff for: Modules/Setup.stdlib.in

+7-1
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,14 @@
6161
# Modules with some UNIX dependencies
6262
#
6363

64-
# Linux and FreeBSD, needs sys/soundcard.h or linux/soundcard.h
64+
@MODULE_GRP_TRUE@grp grpmodule.c
65+
# needs sys/soundcard.h or linux/soundcard.h (Linux, FreeBSD)
6566
@MODULE_OSSAUDIODEV_TRUE@ossaudiodev ossaudiodev.c
67+
@MODULE_RESOURCE_TRUE@resource resource.c
68+
# AIX has shadow passwords, but does not provide getspent API
69+
@MODULE_SPWD_TRUE@spwd spwdmodule.c
70+
@MODULE_SYSLOG_TRUE@syslog syslogmodule.c
71+
@MODULE_TERMIOS_TRUE@termios termios.c
6672

6773

6874
############################################################################

Diff for: configure

+227-2
Original file line numberDiff line numberDiff line change
@@ -658,10 +658,20 @@ MODULE__ELEMENTTREE_FALSE
658658
MODULE__ELEMENTTREE_TRUE
659659
MODULE_PYEXPAT_FALSE
660660
MODULE_PYEXPAT_TRUE
661+
MODULE_TERMIOS_FALSE
662+
MODULE_TERMIOS_TRUE
663+
MODULE_SYSLOG_FALSE
664+
MODULE_SYSLOG_TRUE
665+
MODULE_SPWD_FALSE
666+
MODULE_SPWD_TRUE
661667
MODULE__SCPROXY_FALSE
662668
MODULE__SCPROXY_TRUE
669+
MODULE_RESOURCE_FALSE
670+
MODULE_RESOURCE_TRUE
663671
MODULE_OSSAUDIODEV_FALSE
664672
MODULE_OSSAUDIODEV_TRUE
673+
MODULE_GRP_FALSE
674+
MODULE_GRP_TRUE
665675
MODULE__DATETIME_FALSE
666676
MODULE__DATETIME_TRUE
667677
MODULE_TIME_FALSE
@@ -8196,7 +8206,7 @@ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
81968206
libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
81978207
linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
81988208
sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h \
8199-
sys/mman.h sys/eventfd.h linux/soundcard.h sys/soundcard.h
8209+
sys/mman.h sys/eventfd.h linux/soundcard.h sys/soundcard.h syslog.h
82008210
do :
82018211
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
82028212
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -12658,7 +12668,7 @@ for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
1265812668
explicit_memset faccessat fchmod fchmodat fchown fchownat \
1265912669
fdwalk fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \
1266012670
futimens futimes gai_strerror getentropy \
12661-
getgrgid_r getgrnam_r \
12671+
getgrgid getgrgid_r getgrnam_r \
1266212672
getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \
1266312673
getpriority getresuid getresgid getpwent getpwnam_r getpwuid_r getspnam getspent getsid getwd \
1266412674
if_nameindex \
@@ -19551,6 +19561,45 @@ fi
1955119561

1955219562

1955319563

19564+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module grp" >&5
19565+
$as_echo_n "checking for stdlib extension module grp... " >&6; }
19566+
case $py_stdlib_not_available in #(
19567+
*grp*) :
19568+
py_cv_module_grp=n/a ;; #(
19569+
*) :
19570+
19571+
if true; then :
19572+
if test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes; then :
19573+
py_cv_module_grp=yes
19574+
else
19575+
py_cv_module_grp=missing
19576+
fi
19577+
else
19578+
py_cv_module_grp=disabled
19579+
19580+
fi
19581+
19582+
;;
19583+
esac
19584+
as_fn_append MODULE_BLOCK "MODULE_GRP=$py_cv_module_grp$as_nl"
19585+
if test "x$py_cv_module_grp" = xyes; then :
19586+
19587+
19588+
19589+
19590+
fi
19591+
if test "$py_cv_module_grp" = yes; then
19592+
MODULE_GRP_TRUE=
19593+
MODULE_GRP_FALSE='#'
19594+
else
19595+
MODULE_GRP_TRUE='#'
19596+
MODULE_GRP_FALSE=
19597+
fi
19598+
19599+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_grp" >&5
19600+
$as_echo "$py_cv_module_grp" >&6; }
19601+
19602+
1955419603
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module ossaudiodev" >&5
1955519604
$as_echo_n "checking for stdlib extension module ossaudiodev... " >&6; }
1955619605
case $py_stdlib_not_available in #(
@@ -19590,6 +19639,45 @@ fi
1959019639
$as_echo "$py_cv_module_ossaudiodev" >&6; }
1959119640

1959219641

19642+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module resource" >&5
19643+
$as_echo_n "checking for stdlib extension module resource... " >&6; }
19644+
case $py_stdlib_not_available in #(
19645+
*resource*) :
19646+
py_cv_module_resource=n/a ;; #(
19647+
*) :
19648+
19649+
if true; then :
19650+
if test "$ac_cv_header_sys_resource_h" = yes; then :
19651+
py_cv_module_resource=yes
19652+
else
19653+
py_cv_module_resource=missing
19654+
fi
19655+
else
19656+
py_cv_module_resource=disabled
19657+
19658+
fi
19659+
19660+
;;
19661+
esac
19662+
as_fn_append MODULE_BLOCK "MODULE_RESOURCE=$py_cv_module_resource$as_nl"
19663+
if test "x$py_cv_module_resource" = xyes; then :
19664+
19665+
19666+
19667+
19668+
fi
19669+
if test "$py_cv_module_resource" = yes; then
19670+
MODULE_RESOURCE_TRUE=
19671+
MODULE_RESOURCE_FALSE='#'
19672+
else
19673+
MODULE_RESOURCE_TRUE='#'
19674+
MODULE_RESOURCE_FALSE=
19675+
fi
19676+
19677+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_resource" >&5
19678+
$as_echo "$py_cv_module_resource" >&6; }
19679+
19680+
1959319681
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _scproxy" >&5
1959419682
$as_echo_n "checking for stdlib extension module _scproxy... " >&6; }
1959519683
case $py_stdlib_not_available in #(
@@ -19629,6 +19717,123 @@ fi
1962919717
$as_echo "$py_cv_module__scproxy" >&6; }
1963019718

1963119719

19720+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module spwd" >&5
19721+
$as_echo_n "checking for stdlib extension module spwd... " >&6; }
19722+
case $py_stdlib_not_available in #(
19723+
*spwd*) :
19724+
py_cv_module_spwd=n/a ;; #(
19725+
*) :
19726+
19727+
if true; then :
19728+
if test "$ac_cv_func_getspent" = yes -o "$ac_cv_func_getspnam" = yes; then :
19729+
py_cv_module_spwd=yes
19730+
else
19731+
py_cv_module_spwd=missing
19732+
fi
19733+
else
19734+
py_cv_module_spwd=disabled
19735+
19736+
fi
19737+
19738+
;;
19739+
esac
19740+
as_fn_append MODULE_BLOCK "MODULE_SPWD=$py_cv_module_spwd$as_nl"
19741+
if test "x$py_cv_module_spwd" = xyes; then :
19742+
19743+
19744+
19745+
19746+
fi
19747+
if test "$py_cv_module_spwd" = yes; then
19748+
MODULE_SPWD_TRUE=
19749+
MODULE_SPWD_FALSE='#'
19750+
else
19751+
MODULE_SPWD_TRUE='#'
19752+
MODULE_SPWD_FALSE=
19753+
fi
19754+
19755+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_spwd" >&5
19756+
$as_echo "$py_cv_module_spwd" >&6; }
19757+
19758+
19759+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module syslog" >&5
19760+
$as_echo_n "checking for stdlib extension module syslog... " >&6; }
19761+
case $py_stdlib_not_available in #(
19762+
*syslog*) :
19763+
py_cv_module_syslog=n/a ;; #(
19764+
*) :
19765+
19766+
if true; then :
19767+
if test "$ac_cv_header_syslog_h" = yes; then :
19768+
py_cv_module_syslog=yes
19769+
else
19770+
py_cv_module_syslog=missing
19771+
fi
19772+
else
19773+
py_cv_module_syslog=disabled
19774+
19775+
fi
19776+
19777+
;;
19778+
esac
19779+
as_fn_append MODULE_BLOCK "MODULE_SYSLOG=$py_cv_module_syslog$as_nl"
19780+
if test "x$py_cv_module_syslog" = xyes; then :
19781+
19782+
19783+
19784+
19785+
fi
19786+
if test "$py_cv_module_syslog" = yes; then
19787+
MODULE_SYSLOG_TRUE=
19788+
MODULE_SYSLOG_FALSE='#'
19789+
else
19790+
MODULE_SYSLOG_TRUE='#'
19791+
MODULE_SYSLOG_FALSE=
19792+
fi
19793+
19794+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_syslog" >&5
19795+
$as_echo "$py_cv_module_syslog" >&6; }
19796+
19797+
19798+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module termios" >&5
19799+
$as_echo_n "checking for stdlib extension module termios... " >&6; }
19800+
case $py_stdlib_not_available in #(
19801+
*termios*) :
19802+
py_cv_module_termios=n/a ;; #(
19803+
*) :
19804+
19805+
if true; then :
19806+
if test "$ac_cv_header_termios_h" = yes; then :
19807+
py_cv_module_termios=yes
19808+
else
19809+
py_cv_module_termios=missing
19810+
fi
19811+
else
19812+
py_cv_module_termios=disabled
19813+
19814+
fi
19815+
19816+
;;
19817+
esac
19818+
as_fn_append MODULE_BLOCK "MODULE_TERMIOS=$py_cv_module_termios$as_nl"
19819+
if test "x$py_cv_module_termios" = xyes; then :
19820+
19821+
19822+
19823+
19824+
fi
19825+
if test "$py_cv_module_termios" = yes; then
19826+
MODULE_TERMIOS_TRUE=
19827+
MODULE_TERMIOS_FALSE='#'
19828+
else
19829+
MODULE_TERMIOS_TRUE='#'
19830+
MODULE_TERMIOS_FALSE=
19831+
fi
19832+
19833+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_termios" >&5
19834+
$as_echo "$py_cv_module_termios" >&6; }
19835+
19836+
1963219837

1963319838
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module pyexpat" >&5
1963419839
$as_echo_n "checking for stdlib extension module pyexpat... " >&6; }
@@ -20428,14 +20633,34 @@ if test -z "${MODULE__DATETIME_TRUE}" && test -z "${MODULE__DATETIME_FALSE}"; th
2042820633
as_fn_error $? "conditional \"MODULE__DATETIME\" was never defined.
2042920634
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2043020635
fi
20636+
if test -z "${MODULE_GRP_TRUE}" && test -z "${MODULE_GRP_FALSE}"; then
20637+
as_fn_error $? "conditional \"MODULE_GRP\" was never defined.
20638+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
20639+
fi
2043120640
if test -z "${MODULE_OSSAUDIODEV_TRUE}" && test -z "${MODULE_OSSAUDIODEV_FALSE}"; then
2043220641
as_fn_error $? "conditional \"MODULE_OSSAUDIODEV\" was never defined.
2043320642
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2043420643
fi
20644+
if test -z "${MODULE_RESOURCE_TRUE}" && test -z "${MODULE_RESOURCE_FALSE}"; then
20645+
as_fn_error $? "conditional \"MODULE_RESOURCE\" was never defined.
20646+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
20647+
fi
2043520648
if test -z "${MODULE__SCPROXY_TRUE}" && test -z "${MODULE__SCPROXY_FALSE}"; then
2043620649
as_fn_error $? "conditional \"MODULE__SCPROXY\" was never defined.
2043720650
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2043820651
fi
20652+
if test -z "${MODULE_SPWD_TRUE}" && test -z "${MODULE_SPWD_FALSE}"; then
20653+
as_fn_error $? "conditional \"MODULE_SPWD\" was never defined.
20654+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
20655+
fi
20656+
if test -z "${MODULE_SYSLOG_TRUE}" && test -z "${MODULE_SYSLOG_FALSE}"; then
20657+
as_fn_error $? "conditional \"MODULE_SYSLOG\" was never defined.
20658+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
20659+
fi
20660+
if test -z "${MODULE_TERMIOS_TRUE}" && test -z "${MODULE_TERMIOS_FALSE}"; then
20661+
as_fn_error $? "conditional \"MODULE_TERMIOS\" was never defined.
20662+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
20663+
fi
2043920664
if test -z "${MODULE_PYEXPAT_TRUE}" && test -z "${MODULE_PYEXPAT_FALSE}"; then
2044020665
as_fn_error $? "conditional \"MODULE_PYEXPAT\" was never defined.
2044120666
Usually this means the macro was only invoked conditionally." "$LINENO" 5

Diff for: configure.ac

+7-2
Original file line numberDiff line numberDiff line change
@@ -2162,7 +2162,7 @@ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
21622162
libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
21632163
linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
21642164
sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h \
2165-
sys/mman.h sys/eventfd.h linux/soundcard.h sys/soundcard.h)
2165+
sys/mman.h sys/eventfd.h linux/soundcard.h sys/soundcard.h syslog.h)
21662166
AC_HEADER_DIRENT
21672167
AC_HEADER_MAJOR
21682168

@@ -3854,7 +3854,7 @@ AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
38543854
explicit_memset faccessat fchmod fchmodat fchown fchownat \
38553855
fdwalk fexecve fdopendir fork fpathconf fstatat ftime ftruncate futimesat \
38563856
futimens futimes gai_strerror getentropy \
3857-
getgrgid_r getgrnam_r \
3857+
getgrgid getgrgid_r getgrnam_r \
38583858
getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \
38593859
getpriority getresuid getresgid getpwent getpwnam_r getpwuid_r getspnam getspent getsid getwd \
38603860
if_nameindex \
@@ -6060,11 +6060,16 @@ dnl always enabled extension modules
60606060
PY_STDLIB_MOD_SIMPLE([_datetime], [], [$TIMEMODULE_LIB $LIBM])
60616061

60626062
dnl platform specific extensions
6063+
PY_STDLIB_MOD([grp], [], [test "$ac_cv_func_getgrgid" = yes -o "$ac_cv_func_getgrgid_r" = yes])
60636064
PY_STDLIB_MOD([ossaudiodev],
60646065
[], [test "$ac_cv_header_linux_soundcard_h" = yes -o "$ac_cv_header_sys_soundcard_h" = yes])
6066+
PY_STDLIB_MOD([resource], [], [test "$ac_cv_header_sys_resource_h" = yes])
60656067
PY_STDLIB_MOD([_scproxy],
60666068
[test "$ac_sys_system" = "Darwin"], [],
60676069
[], [-framework SystemConfiguration -framework CoreFoundation])
6070+
PY_STDLIB_MOD([spwd], [], [test "$ac_cv_func_getspent" = yes -o "$ac_cv_func_getspnam" = yes])
6071+
PY_STDLIB_MOD([syslog], [], [test "$ac_cv_header_syslog_h" = yes])
6072+
PY_STDLIB_MOD([termios], [], [test "$ac_cv_header_termios_h" = yes])
60686073

60696074
dnl _elementtree loads libexpat via CAPI hook in pyexpat
60706075
PY_STDLIB_MOD([pyexpat], [], [], [$LIBEXPAT_CFLAGS], [$LIBEXPAT_LDFLAGS])

Diff for: pyconfig.h.in

+6
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,9 @@
441441
/* Define to 1 if you have the `getentropy' function. */
442442
#undef HAVE_GETENTROPY
443443

444+
/* Define to 1 if you have the `getgrgid' function. */
445+
#undef HAVE_GETGRGID
446+
444447
/* Define to 1 if you have the `getgrgid_r' function. */
445448
#undef HAVE_GETGRGID_R
446449

@@ -1143,6 +1146,9 @@
11431146
/* Define to 1 if you have the <sysexits.h> header file. */
11441147
#undef HAVE_SYSEXITS_H
11451148

1149+
/* Define to 1 if you have the <syslog.h> header file. */
1150+
#undef HAVE_SYSLOG_H
1151+
11461152
/* Define to 1 if you have the <sys/audioio.h> header file. */
11471153
#undef HAVE_SYS_AUDIOIO_H
11481154

0 commit comments

Comments
 (0)