New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loading TCL / Tk symbols dynamically #6442
Commits on May 17, 2016
-
WIP: loading TCL / Tk symbols dynamically
This is an attempt to load the symbols we need from the Tkinter.tkinter module at run time, rather than by linking at build time. It is one way of building a manylinux wheel that can build on a basic Manylinux docker image, and then run with the TCL / Tk library installed on the installing user's machine. It would also make the situation better on OSX, where we have to build against ActiveState TCL for compatibility with Python.org Python, but we would like to allow run-time TCL from e.g. homebrew. I have tested this on Debian Jessie Python 2.7 and 3.5, and on OSX 10.9 with Python 2.7. Questions: * Would y'all consider carrying something like this approach in the matplotlib source, but not enabled by default, to help building binary wheels? * Do you have any better suggestions about how to do this? * My C fu is weak; is there a way of collecting the typedefs I need from the TCL / Tk headers rather than copying them into the _tkagg.cpp source file (typdefs starting around line 52)? * My fu for Python C extension modules is also weak; did I configure exceptions and handle references correctly?
-
RF: refactor C code to Michael D's commments
Refactoring for style. Check Python 3 filename encoding result.
Commits on May 18, 2016
-
NF: add Windows support for TCL dynamic loading
Try adding defines etc for using LoadLibrary on Windows to get the TCL / Tk routines.
-
RF: make dynamic loading of TCL the one true way
Remove ifdefs that allowed not-dynamic library resolution of TCL / Tk symbols.
-
RF: disable build-time link against TCL/Tk
Disable link to TCL / Tk libraries now we are loading symbols at run-time.
Commits on May 19, 2016
-
RF: find TCL / Tk symbols correctly on Windows
As Christoph G found, we can't use the tkinter extension module to find the TCL / Tk symbols on Windows, because Windows DLLs do not return the addresses of symbols they import from GetProcAddress. Instead, iterate through the modules loaded in the current process to find the TCL and Tk symbols. See: * https://msdn.microsoft.com/en-us/library/windows/desktop/ms682621(v=vs.85).aspx * https://msdn.microsoft.com/en-us/library/windows/desktop/ms683179(v=vs.85).aspx
Commits on May 20, 2016
-
RF: short-circuit the Tk function tests
Stop testing for Tk routines when one is missing.
-
WIP: Add excerpts from TCL / Tk header
Add parts of TCL / Tk headers needed to compile. If this header is enough, and correct across platforms, then we should be able to remove the complicated TCL / Tk search algorithms at build time.
Commits on May 23, 2016
-
RF: check, edit, refactor Tcl / tk mini header
Move typedefs into Tcl / tk mini header. Rename typedefs for clarity. Strip older definition of Tcl_Interp. Check all defines compatible with Tcl / Tk 8.5 and current trunk (as of 21 May 2016).
-
RF: remove Tcl / Tk header / lib discovery
We now don't need the Tcl / Tk headers or libraries to build.
-
RF: remove build-time check of Tkinter
We don't need Tkinter at build time. We could move this Tkinter version check to `matplotlib/backends/tkagg.py` as a run-time check, but it's very unlikely that any Python we support would be linked against Tcl / Tk < 8.4. For example, the Python 2.5 Python.org OSX install links against Tcl / Tk 8.5, and the default Tcl / Tk on CentOS 5.11 is 8.4.
-
RF: force TkAgg / Agg extensions with messages
Now we can always build TkAgg, so force building of Agg and TkAgg.
-
BF: fix goofy double "installing" message
Returning 'installing' from Windows check_requirements results in the message '[installing, installing]', because the `check` method default return string is also 'installing'.
Commits on May 24, 2016
-
TST: add test of tkagg backend import
Check that we can correctly import tkagg on travis and appveyor.