Skip to content

Commit d5397d3

Browse files
author
Erlend E. Aasland
committed
bpo-45847: Port socket to PY_STDLIB_MOD_SIMPLE
1 parent 4d6c0c0 commit d5397d3

File tree

5 files changed

+54
-6
lines changed

5 files changed

+54
-6
lines changed

Modules/Setup.stdlib.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
@MODULE__POSIXSUBPROCESS_TRUE@_posixsubprocess _posixsubprocess.c
110110
@MODULE_RESOURCE_TRUE@resource resource.c
111111
@MODULE_SELECT_TRUE@select selectmodule.c
112+
@MODULE__SOCKET_TRUE@_socket socketmodule.c
112113
# AIX has shadow passwords, but does not provide getspent API
113114
@MODULE_SPWD_TRUE@spwd spwdmodule.c
114115
@MODULE_SYSLOG_TRUE@syslog syslogmodule.c

configure

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,8 @@ MODULE_OSSAUDIODEV_FALSE
698698
MODULE_OSSAUDIODEV_TRUE
699699
MODULE_GRP_FALSE
700700
MODULE_GRP_TRUE
701+
MODULE__SOCKET_FALSE
702+
MODULE__SOCKET_TRUE
701703
MODULE_MMAP_FALSE
702704
MODULE_MMAP_TRUE
703705
MODULE_FCNTL_FALSE
@@ -8309,7 +8311,7 @@ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
83098311
libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
83108312
linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
83118313
sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h \
8312-
sys/mman.h sys/eventfd.h linux/soundcard.h sys/soundcard.h syslog.h
8314+
sys/mman.h sys/eventfd.h linux/soundcard.h sys/soundcard.h syslog.h netinet/in.h
83138315
do :
83148316
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
83158317
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -20739,6 +20741,42 @@ fi
2073920741
$as_echo "$py_cv_module_mmap" >&6; }
2074020742

2074120743

20744+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _socket" >&5
20745+
$as_echo_n "checking for stdlib extension module _socket... " >&6; }
20746+
case $py_stdlib_not_available in #(
20747+
*_socket*) :
20748+
py_cv_module__socket=n/a ;; #(
20749+
*) :
20750+
if true; then :
20751+
if test "$ac_cv_header_sys_socket_h" = "yes" -a "$ac_cv_header_sys_types_h" = "yes" -a "$ac_cv_header_netinet_in_h" = "yes"; then :
20752+
py_cv_module__socket=yes
20753+
else
20754+
py_cv_module__socket=missing
20755+
fi
20756+
else
20757+
py_cv_module__socket=disabled
20758+
fi
20759+
;;
20760+
esac
20761+
as_fn_append MODULE_BLOCK "MODULE__SOCKET=$py_cv_module__socket$as_nl"
20762+
if test "x$py_cv_module__socket" = xyes; then :
20763+
20764+
20765+
20766+
20767+
fi
20768+
if test "$py_cv_module__socket" = yes; then
20769+
MODULE__SOCKET_TRUE=
20770+
MODULE__SOCKET_FALSE='#'
20771+
else
20772+
MODULE__SOCKET_TRUE='#'
20773+
MODULE__SOCKET_FALSE=
20774+
fi
20775+
20776+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__socket" >&5
20777+
$as_echo "$py_cv_module__socket" >&6; }
20778+
20779+
2074220780

2074320781
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module grp" >&5
2074420782
$as_echo_n "checking for stdlib extension module grp... " >&6; }
@@ -22066,6 +22104,10 @@ if test -z "${MODULE_MMAP_TRUE}" && test -z "${MODULE_MMAP_FALSE}"; then
2206622104
as_fn_error $? "conditional \"MODULE_MMAP\" was never defined.
2206722105
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2206822106
fi
22107+
if test -z "${MODULE__SOCKET_TRUE}" && test -z "${MODULE__SOCKET_FALSE}"; then
22108+
as_fn_error $? "conditional \"MODULE__SOCKET\" was never defined.
22109+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
22110+
fi
2206922111
if test -z "${MODULE_GRP_TRUE}" && test -z "${MODULE_GRP_FALSE}"; then
2207022112
as_fn_error $? "conditional \"MODULE_GRP\" was never defined.
2207122113
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
@@ -2188,7 +2188,7 @@ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
21882188
libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
21892189
linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
21902190
sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h \
2191-
sys/mman.h sys/eventfd.h linux/soundcard.h sys/soundcard.h syslog.h)
2191+
sys/mman.h sys/eventfd.h linux/soundcard.h sys/soundcard.h syslog.h netinet/in.h)
21922192
AC_HEADER_DIRENT
21932193
AC_HEADER_MAJOR
21942194

@@ -6157,6 +6157,10 @@ PY_STDLIB_MOD([fcntl],
61576157
[], [$FCNTL_LIBS])
61586158
PY_STDLIB_MOD([mmap],
61596159
[], [test "$ac_cv_header_sys_mman_h" = "yes" -a "$ac_cv_header_sys_stat_h" = "yes"])
6160+
PY_STDLIB_MOD([_socket],
6161+
[], m4_flatten([test "$ac_cv_header_sys_socket_h" = "yes"
6162+
-a "$ac_cv_header_sys_types_h" = "yes"
6163+
-a "$ac_cv_header_netinet_in_h" = "yes"]))
61606164

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

pyconfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,9 @@
757757
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
758758
#undef HAVE_NDIR_H
759759

760+
/* Define to 1 if you have the <netinet/in.h> header file. */
761+
#undef HAVE_NETINET_IN_H
762+
760763
/* Define to 1 if you have the <netpacket/packet.h> header file. */
761764
#undef HAVE_NETPACKET_PACKET_H
762765

setup.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,8 @@ def detect_simple_extensions(self):
10341034
self.addext(Extension('fcntl', ['fcntlmodule.c']))
10351035
# grp(3)
10361036
self.addext(Extension('grp', ['grpmodule.c']))
1037+
1038+
self.addext(Extension('_socket', ['socketmodule.c']))
10371039
self.addext(Extension('spwd', ['spwdmodule.c']))
10381040

10391041
# select(2); not on ancient System V
@@ -1254,9 +1256,6 @@ def detect_crypt(self):
12541256

12551257
self.add(Extension('_crypt', ['_cryptmodule.c'], libraries=libs))
12561258

1257-
def detect_socket(self):
1258-
self.add(Extension('_socket', ['socketmodule.c']))
1259-
12601259
def detect_dbm_gdbm(self):
12611260
# Modules that provide persistent dictionary-like semantics. You will
12621261
# probably want to arrange for at least one of them to be available on
@@ -1460,7 +1459,6 @@ def detect_modules(self):
14601459
self.detect_test_extensions()
14611460
self.detect_readline_curses()
14621461
self.detect_crypt()
1463-
self.detect_socket()
14641462
self.detect_openssl_hashlib()
14651463
self.detect_hash_builtins()
14661464
self.detect_dbm_gdbm()

0 commit comments

Comments
 (0)