Skip to content

Commit

Permalink
bpo-45847: Port _tkinter to PY_STDLIB_MOD (GH-31698)
Browse files Browse the repository at this point in the history
- Remove ``--with-tclk-*`` options from `configure`
- Use pkg-config to detect `_tkinter` dependencies (Tcl/Tk, X11)
- Manual override via environment variables `TCLTK_CFLAGS` and `TCLTK_LIBS`
  • Loading branch information
Erlend Egeberg Aasland authored Mar 31, 2022
1 parent 7fc39a2 commit b36d222
Show file tree
Hide file tree
Showing 10 changed files with 402 additions and 517 deletions.
8 changes: 0 additions & 8 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -404,14 +404,6 @@ Libraries options

.. versionadded:: 3.10

.. cmdoption:: --with-tcltk-includes='-I...'

Override search for Tcl and Tk include files.

.. cmdoption:: --with-tcltk-libs='-L...'

Override search for Tcl and Tk libraries.

.. cmdoption:: --with-libm=STRING

Override ``libm`` math library to *STRING* (default is system-dependent).
Expand Down
4 changes: 2 additions & 2 deletions Doc/whatsnew/3.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2019,8 +2019,8 @@ Build Changes
* The ``configure`` script now uses the ``pkg-config`` utility, if available,
to detect the location of Tcl/Tk headers and libraries. As before, those
locations can be explicitly specified with the :option:`--with-tcltk-includes`
and :option:`--with-tcltk-libs` configuration options.
locations can be explicitly specified with the ``--with-tcltk-includes``
and ``--with-tcltk-libs`` configuration options.
(Contributed by Manolis Stamatogiannakis in :issue:`42603`.)
* Add :option:`--with-openssl-rpath` option to ``configure`` script. The option
Expand Down
10 changes: 8 additions & 2 deletions Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -770,11 +770,17 @@ Build Changes

* Build dependencies, compiler flags, and linker flags for most stdlib
extension modules are now detected by :program:`configure`. libffi, libnsl,
libsqlite3, zlib, bzip2, liblzma, libcrypt, and uuid flags are detected by
``pkg-config`` (when available).
libsqlite3, zlib, bzip2, liblzma, libcrypt, Tcl/Tk libs, and uuid flags
are detected by ``pkg-config`` (when available).
(Contributed by Christian Heimes and Erlend Egeberg Aasland in
:issue:`bpo-45847`, :issue:`45747`, and :issue:`45763`.)

.. note::
Use the environment variables ``TCLTK_CFLAGS`` and ``TCLTK_LIBS`` to
manually specify the location of Tcl/Tk headers and libraries.
The :program:`configure` options ``--with-tcltk-includes`` and
``--with-tcltk-libs`` have been removed.

* CPython now has experimental support for cross compiling to WebAssembly
platform ``wasm32-emscripten``. The effort is inspired by previous work
like Pyodide.
Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ Build Changes
of macOS. If a macOS SDK is explicitly configured, by using
:option:`--enable-universalsdk` or ``-isysroot``, only the SDK itself is
searched. The default behavior can still be overridden with
:option:`--with-tcltk-includes` and :option:`--with-tcltk-libs`.
``--with-tcltk-includes`` and ``--with-tcltk-libs``.
(Contributed by Ned Deily in :issue:`34956`.)

* Python can now be built for Windows 10 ARM64.
Expand Down
6 changes: 0 additions & 6 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,6 @@ _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
BUILD_GNU_TYPE= @build@
HOST_GNU_TYPE= @host@

# Tcl and Tk config info from --with-tcltk-includes and -libs options
TCLTK_INCLUDES= @TCLTK_INCLUDES@
TCLTK_LIBS= @TCLTK_LIBS@

# The task to run while instrumented when building the profile-opt target.
# To speed up profile generation, we don't run the full unit test suite
# by default. The default is "-m test --pgo". To run more tests, use
Expand Down Expand Up @@ -736,10 +732,8 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt @LIBMPDEC_INTERNAL@ @LIBEXPAT_INTERNAL
*) quiet="";; \
esac; \
echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build


Expand Down
5 changes: 2 additions & 3 deletions Modules/Setup.stdlib.in
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,11 @@
# needs -lcrypt
@MODULE__HASHLIB_TRUE@_hashlib _hashopenssl.c

# needs -ltk, -ltcl, and sometimes -lX11
#@MODULE__TKINTER_TRUE@_tkinter _tkinter.c tkappinit.c

# Linux: -luuid, BSD/AIX: libc's uuid_create()
@MODULE__UUID_TRUE@_uuid _uuidmodule.c

@MODULE__TKINTER_TRUE@_tkinter _tkinter.c tkappinit.c

############################################################################
# macOS specific modules

Expand Down
Loading

0 comments on commit b36d222

Please sign in to comment.