Skip to content
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

Merged
merged 14 commits into from May 24, 2016

Commits on May 17, 2016

  1. 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?
    matthew-brett committed May 17, 2016
    Copy the full SHA
    edc80a3 View commit details
    Browse the repository at this point in the history
  2. RF: refactor C code to Michael D's commments

    Refactoring for style.  Check Python 3 filename encoding result.
    matthew-brett committed May 17, 2016
    Copy the full SHA
    64f01dd View commit details
    Browse the repository at this point in the history

Commits on May 18, 2016

  1. NF: add Windows support for TCL dynamic loading

    Try adding defines etc for using LoadLibrary on Windows to get the TCL /
    Tk routines.
    matthew-brett committed May 18, 2016
    Copy the full SHA
    89535be View commit details
    Browse the repository at this point in the history
  2. RF: make dynamic loading of TCL the one true way

    Remove ifdefs that allowed not-dynamic library resolution of TCL / Tk
    symbols.
    matthew-brett committed May 18, 2016
    Copy the full SHA
    fc5d060 View commit details
    Browse the repository at this point in the history
  3. RF: disable build-time link against TCL/Tk

    Disable link to TCL / Tk libraries now we are loading symbols at
    run-time.
    matthew-brett committed May 18, 2016
    Copy the full SHA
    1c85968 View commit details
    Browse the repository at this point in the history

Commits on May 19, 2016

  1. 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
    matthew-brett committed May 19, 2016
    Copy the full SHA
    830d7a3 View commit details
    Browse the repository at this point in the history

Commits on May 20, 2016

  1. RF: short-circuit the Tk function tests

    Stop testing for Tk routines when one is missing.
    matthew-brett committed May 20, 2016
    Copy the full SHA
    4c5a3ab View commit details
    Browse the repository at this point in the history
  2. 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.
    matthew-brett committed May 20, 2016
    Copy the full SHA
    94bb457 View commit details
    Browse the repository at this point in the history

Commits on May 23, 2016

  1. 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).
    matthew-brett committed May 23, 2016
    Copy the full SHA
    3f5407a View commit details
    Browse the repository at this point in the history
  2. RF: remove Tcl / Tk header / lib discovery

    We now don't need the Tcl / Tk headers or libraries to build.
    matthew-brett committed May 23, 2016
    Copy the full SHA
    573aeb5 View commit details
    Browse the repository at this point in the history
  3. 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.
    matthew-brett committed May 23, 2016
    Copy the full SHA
    626a1d2 View commit details
    Browse the repository at this point in the history
  4. RF: force TkAgg / Agg extensions with messages

    Now we can always build TkAgg, so force building of Agg and TkAgg.
    matthew-brett committed May 23, 2016
    Copy the full SHA
    0c2c5a0 View commit details
    Browse the repository at this point in the history
  5. 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'.
    matthew-brett committed May 23, 2016
    Copy the full SHA
    de99a76 View commit details
    Browse the repository at this point in the history

Commits on May 24, 2016

  1. TST: add test of tkagg backend import

    Check that we can correctly import tkagg on travis and appveyor.
    matthew-brett committed May 24, 2016
    Copy the full SHA
    aa275c6 View commit details
    Browse the repository at this point in the history