[Python-checkins] bpo-45847: Port _scproxy to PY_STDLIB_MOD (GH-29644)

tiran webhook-mailer at python.org
Sat Nov 20 04:18:59 EST 2021


https://github.com/python/cpython/commit/5596909eac4abdc9927c2e7751bea34fbcfdc624
commit: 5596909eac4abdc9927c2e7751bea34fbcfdc624
branch: main
author: Christian Heimes <christian at python.org>
committer: tiran <christian at python.org>
date: 2021-11-20T10:18:48+01:00
summary:

bpo-45847: Port _scproxy to PY_STDLIB_MOD (GH-29644)

files:
M Modules/Setup
M Modules/Setup.stdlib.in
M configure
M configure.ac
M setup.py

diff --git a/Modules/Setup b/Modules/Setup
index 5a7c232d3c555..d3647ecb99592 100644
--- a/Modules/Setup
+++ b/Modules/Setup
@@ -267,8 +267,8 @@ PYTHONPATH=$(COREPYTHONPATH)
 #_curses -lncurses -lncursesw -ltermcap _cursesmodule.c
 #_curses_panel -lpanel -lncurses _curses_panel.c
 
-# macOS specific modules
-# _scproxy _scproxy.c -framework SystemConfiguration -framework CoreFoundation
+# macOS specific module, needs SystemConfiguration and CoreFoundation framework
+# _scproxy _scproxy.c
 
 # Examples
 
diff --git a/Modules/Setup.stdlib.in b/Modules/Setup.stdlib.in
index ee07f4d5d8ea4..4e5c158c0fdb2 100644
--- a/Modules/Setup.stdlib.in
+++ b/Modules/Setup.stdlib.in
@@ -69,3 +69,10 @@
 # Modules with third party dependencies
 #
 @MODULE__SQLITE3_TRUE at _sqlite3 _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c
+
+
+############################################################################
+# macOS specific modules
+
+# _scproxy needs SystemConfiguration and CoreFoundation framework
+ at MODULE__SCPROXY_TRUE@_scproxy _scproxy.c
diff --git a/configure b/configure
index e8935dfb625fe..9340cb072199c 100755
--- a/configure
+++ b/configure
@@ -644,6 +644,8 @@ MODULE__ELEMENTTREE_FALSE
 MODULE__ELEMENTTREE_TRUE
 MODULE_PYEXPAT_FALSE
 MODULE_PYEXPAT_TRUE
+MODULE__SCPROXY_FALSE
+MODULE__SCPROXY_TRUE
 MODULE_OSSAUDIODEV_FALSE
 MODULE_OSSAUDIODEV_TRUE
 MODULE__DATETIME_FALSE
@@ -19588,6 +19590,56 @@ fi
 $as_echo "$py_cv_module_ossaudiodev" >&6; }
 
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _scproxy" >&5
+$as_echo_n "checking for stdlib extension module _scproxy... " >&6; }
+      case $py_stdlib_not_available in #(
+  *_scproxy*) :
+    py_cv_module__scproxy=n/a ;; #(
+  *) :
+
+      if test "$ac_sys_system" = "Darwin"; then :
+  if true; then :
+  py_cv_module__scproxy=yes
+else
+  py_cv_module__scproxy=missing
+fi
+else
+  py_cv_module__scproxy=disabled
+
+fi
+
+   ;;
+esac
+  as_fn_append MODULE_BLOCK "MODULE__SCPROXY=$py_cv_module__scproxy$as_nl"
+  if test "x$py_cv_module__scproxy" = xyes; then :
+
+    as_fn_append MODULE_BLOCK "MODULE__SCPROXY_CFLAGS=$as_nl"
+    as_fn_append MODULE_BLOCK "MODULE__SCPROXY_LDFLAGS=-framework SystemConfiguration -framework CoreFoundation$as_nl"
+     if true; then
+  MODULE__SCPROXY_TRUE=
+  MODULE__SCPROXY_FALSE='#'
+else
+  MODULE__SCPROXY_TRUE='#'
+  MODULE__SCPROXY_FALSE=
+fi
+
+
+else
+
+     if false; then
+  MODULE__SCPROXY_TRUE=
+  MODULE__SCPROXY_FALSE='#'
+else
+  MODULE__SCPROXY_TRUE='#'
+  MODULE__SCPROXY_FALSE=
+fi
+
+
+fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__scproxy" >&5
+$as_echo "$py_cv_module__scproxy" >&6; }
+
+
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module pyexpat" >&5
 $as_echo_n "checking for stdlib extension module pyexpat... " >&6; }
@@ -20231,6 +20283,14 @@ if test -z "${MODULE_OSSAUDIODEV_TRUE}" && test -z "${MODULE_OSSAUDIODEV_FALSE}"
   as_fn_error $? "conditional \"MODULE_OSSAUDIODEV\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${MODULE__SCPROXY_TRUE}" && test -z "${MODULE__SCPROXY_FALSE}"; then
+  as_fn_error $? "conditional \"MODULE__SCPROXY\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${MODULE__SCPROXY_TRUE}" && test -z "${MODULE__SCPROXY_FALSE}"; then
+  as_fn_error $? "conditional \"MODULE__SCPROXY\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${MODULE_PYEXPAT_TRUE}" && test -z "${MODULE_PYEXPAT_FALSE}"; then
   as_fn_error $? "conditional \"MODULE_PYEXPAT\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/configure.ac b/configure.ac
index 754b066f52ed0..924659713e474 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6062,6 +6062,9 @@ PY_STDLIB_MOD_SIMPLE([_datetime], [], [$TIMEMODULE_LIB $LIBM])
 dnl platform specific extensions
 PY_STDLIB_MOD([ossaudiodev],
   [], [test "$ac_cv_header_linux_soundcard_h" = yes -o "$ac_cv_header_sys_soundcard_h" = yes])
+PY_STDLIB_MOD([_scproxy],
+  [test "$ac_sys_system" = "Darwin"], [],
+  [], [-framework SystemConfiguration -framework CoreFoundation])
 
 dnl _elementtree loads libexpat via CAPI hook in pyexpat
 PY_STDLIB_MOD([pyexpat], [], [], [$LIBEXPAT_CFLAGS], [$LIBEXPAT_LDFLAGS])
diff --git a/setup.py b/setup.py
index 3e3075d8d9ac6..83a676bfefbbe 100644
--- a/setup.py
+++ b/setup.py
@@ -1389,11 +1389,8 @@ def detect_platform_specific_exts(self):
         # linux/soundcard.h or sys/soundcard.h
         self.addext(Extension('ossaudiodev', ['ossaudiodev.c']))
 
-        if MACOS:
-            self.add(Extension('_scproxy', ['_scproxy.c'],
-                               extra_link_args=[
-                                   '-framework', 'SystemConfiguration',
-                                   '-framework', 'CoreFoundation']))
+        # macOS-only, needs SystemConfiguration and CoreFoundation framework
+        self.addext(Extension('_scproxy', ['_scproxy.c']))
 
     def detect_compress_exts(self):
         # Andrew Kuchling's zlib module.



More information about the Python-checkins mailing list