From: Zachary Ware Date: Sat, 24 Oct 2015 06:34:22 +0000 (-0500) Subject: Closes #25456: Copy Tcl/Tk DLLs to build directory on Windows X-Git-Tag: v3.5.1rc1~131^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=677744b3861f446ede2db16fba2e55c3764aa85f;p=python Closes #25456: Copy Tcl/Tk DLLs to build directory on Windows This removes the need to add externals/tcltk[64]/bin to PATH to be able to import tkinter. Also documents the necessity for the DLLs to be on PATH or in python.exe's directory. --- diff --git a/PCbuild/build.bat b/PCbuild/build.bat index f3bc1e3b8b..0c482f5eb3 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -82,6 +82,9 @@ if '%build_tkinter%'=='true' ( nmake -f makefile.vc MACHINE=%machine% OPTS=%options% INSTALLDIR="%tcltkdir%" install-binaries install-libraries popd ) + if not exist "%builddir%tcl86t%tcl_dbg_ext%.dll" ( + xcopy "%tcltkdir%\bin\tcl86t%tcl_dbg_ext%.dll" "%builddir%" + ) if not exist "%tcltkdir%\bin\tk86t%tcl_dbg_ext%.dll" ( pushd "%tkdir%\win" @@ -90,6 +93,9 @@ if '%build_tkinter%'=='true' ( nmake -f makefile.vc MACHINE=%machine% OPTS=%options% INSTALLDIR="%tcltkdir%" TCLDIR="%tcldir%" install-binaries install-libraries popd ) + if not exist "%builddir%tk86t%tcl_dbg_ext%.dll" ( + xcopy "%tcltkdir%\bin\tk86t%tcl_dbg_ext%.dll" "%builddir%" + ) if not exist "%tcltkdir%\lib\tix8.4.3\tix84%tcl_dbg_ext%.dll" ( pushd "%tixdir%\win" diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt index a3c7fbd59f..e0c6685c9e 100644 --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -225,9 +225,15 @@ _tkinter Unlike the other external libraries listed above, Tk must be built separately before the _tkinter module can be built. This means that a pre-built Tcl/Tk installation is expected in ..\externals\tcltk - (tcltk64 for 64-bit) relative to this directory. See "Getting - External Sources" below for the easiest method to ensure Tcl/Tk is - built. + (tcltk64 for 64-bit) relative to this directory; the easiest way to + do so is to build Python using `build.bat -e`, which will build + Tcl, Tk, and Tix and install them as expected. Note that to + import and use tkinter, the Tcl and Tk DLLs must be somewhere that + python.exe can find them, which means that either + ..\externals\tcltk[64]\bin must be added to PATH, or the DLLs must + be copied from that folder to be alongside python.exe. `build.bat` + takes care of it for you by copying the DLLs into the build + directory. Getting External Sources