Skip to content

Commit

Permalink
bpo-45847: Port _scproxy to PY_STDLIB_MOD (GH-29644)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiran authored Nov 20, 2021
1 parent be36e06 commit 5596909
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Modules/Setup
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions Modules/Setup.stdlib.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,10 @@
# Modules with third party dependencies
#
@MODULE__SQLITE3_TRUE@_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
@MODULE__SCPROXY_TRUE@_scproxy _scproxy.c
60 changes: 60 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5596909

Please sign in to comment.