Sophie

Sophie

distrib > Mageia > 9 > armv7hl > media > core-release-src > by-pkgid > d8c679353daa984effd8ef75a56451e3 > files > 22

mingw-python3-3.10.9-1.mga9.src.rpm

diff -rupN --no-dereference Python-3.10.9/configure.ac Python-3.10.9-new/configure.ac
--- Python-3.10.9/configure.ac	2022-12-08 09:36:56.840024805 +0100
+++ Python-3.10.9-new/configure.ac	2022-12-08 09:37:01.847024917 +0100
@@ -4079,10 +4079,14 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 
 AC_MSG_CHECKING(for inet_pton)
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef _WIN32
+#include <ws2tcpip.h>
+#else
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#endif
 ]], [[void* p = inet_pton]])],
   [AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
    AC_MSG_RESULT(yes)],
@@ -4363,21 +4367,36 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 ],[])
 AC_MSG_RESULT($was_it_defined)
 
+AC_CHECK_HEADERS([ws2tcpip.h])
 AC_MSG_CHECKING(for addrinfo)
 AC_CACHE_VAL(ac_cv_struct_addrinfo,
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[struct addrinfo a]])],
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifdef HAVE_WS2TCPIP_H
+#  include <ws2tcpip.h>
+#else
+#  include <netdb.h>
+#endif]],
+    [[struct addrinfo a]])],
   [ac_cv_struct_addrinfo=yes],
   [ac_cv_struct_addrinfo=no]))
 AC_MSG_RESULT($ac_cv_struct_addrinfo)
 if test $ac_cv_struct_addrinfo = yes; then
-	AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
+	AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo])
 fi
 
 AC_MSG_CHECKING(for sockaddr_storage)
 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#		include <sys/types.h>
-#		include <sys/socket.h>]], [[struct sockaddr_storage s]])],
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif]],
+    [[struct sockaddr_storage s]])],
   [ac_cv_struct_sockaddr_storage=yes],
   [ac_cv_struct_sockaddr_storage=no]))
 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
@@ -5553,7 +5572,10 @@ fi
 
 AC_CHECK_TYPE(socklen_t,,
   AC_DEFINE(socklen_t,int,
-            [Define to `int' if <sys/socket.h> does not define.]),[
+            [Define to `int' if <sys/socket.h> or <ws2tcpip.h> does not define.]),[
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
diff -rupN --no-dereference Python-3.10.9/Misc/config_mingw Python-3.10.9-new/Misc/config_mingw
--- Python-3.10.9/Misc/config_mingw	2022-12-08 09:36:55.411024773 +0100
+++ Python-3.10.9-new/Misc/config_mingw	2022-12-08 09:37:01.847024917 +0100
@@ -10,3 +10,6 @@ ac_cv_func_alarm=ignore
 # files to ignore
 ac_cv_file__dev_ptmx=ignore #NOTE: under MSYS environment device exist
 ac_cv_file__dev_ptc=no
+
+# force detection of winsock2 functionality - require wxp or newer
+ac_cv_func_getpeername=yes
diff -rupN --no-dereference Python-3.10.9/Modules/socketmodule.c Python-3.10.9-new/Modules/socketmodule.c
--- Python-3.10.9/Modules/socketmodule.c	2022-12-06 19:31:21.000000000 +0100
+++ Python-3.10.9-new/Modules/socketmodule.c	2022-12-08 09:37:01.849024917 +0100
@@ -265,7 +265,7 @@ shutdown(how) -- shut down traffic in on
 # endif
 
 /* Macros based on the IPPROTO enum, see: https://bugs.python.org/issue29515 */
-#ifdef MS_WINDOWS
+#ifdef _MSC_VER
 #define IPPROTO_ICMP IPPROTO_ICMP
 #define IPPROTO_IGMP IPPROTO_IGMP
 #define IPPROTO_GGP IPPROTO_GGP
@@ -389,6 +389,10 @@ remove_unusable_flags(PyObject *m)
   /* Do not include addrinfo.h for MSVC7 or greater. 'addrinfo' and
    * EAI_* constants are defined in (the already included) ws2tcpip.h.
    */
+#elif defined(__MINGW32__)
+  /* Do not include addrinfo.h as minimum supported version is
+   * _WIN32_WINNT >= WindowsXP(0x0501)
+   */
 #else
 #  include "addrinfo.h"
 #endif
@@ -7946,7 +7950,7 @@ PyInit__socket(void)
     PyModule_AddIntMacro(m, IPPROTO_MAX);
 #endif
 
-#ifdef  MS_WINDOWS
+#ifdef  _MSC_VER
     PyModule_AddIntMacro(m, IPPROTO_ICLFXBM);
     PyModule_AddIntMacro(m, IPPROTO_ST);
     PyModule_AddIntMacro(m, IPPROTO_CBT);
diff -rupN --no-dereference Python-3.10.9/pyconfig.h.in Python-3.10.9-new/pyconfig.h.in
--- Python-3.10.9/pyconfig.h.in	2022-12-06 19:31:21.000000000 +0100
+++ Python-3.10.9-new/pyconfig.h.in	2022-12-08 09:37:01.850024917 +0100
@@ -63,7 +63,7 @@
 /* Define to 1 if you have the `acosh' function. */
 #undef HAVE_ACOSH
 
-/* struct addrinfo (netdb.h) */
+/* struct addrinfo */
 #undef HAVE_ADDRINFO
 
 /* Define to 1 if you have the `alarm' function. */
@@ -1372,6 +1372,9 @@
 /* Define to 1 if you have the `writev' function. */
 #undef HAVE_WRITEV
 
+/* Define to 1 if you have the <ws2tcpip.h> header file. */
+#undef HAVE_WS2TCPIP_H
+
 /* Define if the zlib library has inflateCopy */
 #undef HAVE_ZLIB_COPY
 
@@ -1686,7 +1689,7 @@
 /* Define to `unsigned int' if <sys/types.h> does not define. */
 #undef size_t
 
-/* Define to `int' if <sys/socket.h> does not define. */
+/* Define to `int' if <sys/socket.h> or <ws2tcpip.h> does not define. */
 #undef socklen_t
 
 /* Define to `int' if <sys/types.h> doesn't define. */
diff -rupN --no-dereference Python-3.10.9/setup.py Python-3.10.9-new/setup.py
--- Python-3.10.9/setup.py	2022-12-08 09:37:01.195024902 +0100
+++ Python-3.10.9-new/setup.py	2022-12-08 09:37:01.850024917 +0100
@@ -1267,6 +1267,8 @@ class PyBuildExt(build_ext):
             # Issue #35569: Expose RFC 3542 socket options.
             kwargs['extra_compile_args'] = ['-D__APPLE_USE_RFC_3542']
 
+        if HOST_PLATFORM.startswith(('mingw', 'win')):
+            kwargs['libraries'] = ['ws2_32', 'iphlpapi']
         self.add(Extension('_socket', ['socketmodule.c'], **kwargs))
 
     def detect_dbm_gdbm(self):