Skip to content

Commit c2f20b7

Browse files
committed
unix: build _tkinter extension on macOS
And package required tcl/tk/tix files there as well.
1 parent 2eec125 commit c2f20b7

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

cpython-unix/build-cpython.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,8 @@ cp -av ${TOOLS_PATH}/deps/libedit/lib/*.a ${ROOT}/out/python/build/lib/
242242
rm -f ${ROOT}/out/python/build/lib/{libdb-6.0,libxcb-*,libX11-xcb}.a
243243

244244
# Copy tcl/tk/tix resources needed by tkinter.
245-
if [ "${PYBUILD_PLATFORM}" != "macos" ]; then
246-
mkdir ${ROOT}/out/python/install/lib/tcl
247-
cp -av ${TOOLS_PATH}/deps/lib/{tcl8,tcl8.6,thread2.8.4,Tix8.4.3,tk8.6}/ ${ROOT}/out/python/install/lib/tcl/
248-
fi
245+
mkdir ${ROOT}/out/python/install/lib/tcl
246+
cp -av ${TOOLS_PATH}/deps/lib/{tcl8,tcl8.6,thread2.8.4,Tix8.4.3,tk8.6}/ ${ROOT}/out/python/install/lib/tcl/
249247

250248
# config.c defines _PyImport_Inittab and extern references to modules, which
251249
# downstream consumers may want to strip. We bundle config.c and config.c.in so

cpython-unix/build.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,19 @@ def build_cpython(
525525
dep_platform += "-musl"
526526

527527
# TODO support bdb/gdbm toggle
528-
packages = {"bdb", "bzip2", "libedit", "libffi", "sqlite", "uuid", "xz", "zlib"}
528+
packages = {
529+
"bdb",
530+
"bzip2",
531+
"libedit",
532+
"libffi",
533+
"sqlite",
534+
"tcl",
535+
"tix",
536+
"tk",
537+
"uuid",
538+
"xz",
539+
"zlib",
540+
}
529541

530542
if libressl:
531543
packages.add("libressl")
@@ -541,9 +553,8 @@ def build_cpython(
541553
if readline:
542554
packages.add("readline")
543555

544-
tix = platform == "linux64"
545-
if tix:
546-
packages |= {"libX11", "libXau", "libxcb", "tcl", "tix", "tk", "xorgproto"}
556+
if platform == "linux64":
557+
packages |= {"libX11", "libXau", "libxcb", "xorgproto"}
547558

548559
for p in sorted(packages):
549560
build_env.install_artifact_archive(BUILD, p, platform, musl=musl)

cpython-unix/disabled-static-modules.macos

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# We don't support GDBM because it is GPL v3.
22
_gdbm
3-
# Not yet supported.
4-
_tkinter
53
# Not available on macOS.
64
nis
75
# Not available on macOS.

cpython-unix/static-modules.macos

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ _ssl _ssl.c -lssl -lcrypto
2727
_testbuffer _testbuffer.c
2828
_testimportmultiple _testimportmultiple.c
2929
_testmultiphase _testmultiphase.c
30+
_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT -framework AppKit -framework ApplicationServices -framework Carbon -framework CoreServices -framework CoreGraphics -framework IOKit -ltcl8.6 -ltk8.6
3031
_uuid _uuidmodule.c -luuid
3132
_xxtestfuzz _xxtestfuzz/_xxtestfuzz.c _xxtestfuzz/fuzzer.c
3233
pyexpat pyexpat.c expat/xmlparse.c expat/xmlrole.c expat/xmltok.c -DHAVE_EXPAT_CONFIG_H=1 -DXML_POOR_ENTROPY=1 -DUSE_PYEXPAT_CAPI -IModules/expat

0 commit comments

Comments
 (0)