8000 Build support with dependencies for Windows by jbmohler · Pull Request #3388 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Build support with dependencies for Windows #3388

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
unpack tcl/tk zip files for headers to build on windows
  • Loading branch information
jbmohler committed Aug 20, 2014
commit 223f20c7761d381074dce03e852d56a9e1cb76ce
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ windeps/freetype-2.4.11/
windeps/libpng-1.6.7-build/
windeps/libpng-1.6.7/
windeps/zlib-1.2.8/
windeps/tcl8.5.13/
windeps/tk8.5.13/
windeps/msvcr90-x32/
windeps/msvcr90-x64/
windeps/msvcr100-x32/
Expand Down
6 changes: 5 additions & 1 deletion setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,9 @@ def check_requirements(self):
return "version %s" % tk_v

def get_extension(self):
if sys.platform == 'win32':
setupwin.build_tcl()

sources = [
'src/agg_py_transforms.cpp',
'src/_tkagg.cpp'
Expand Down Expand Up @@ -1508,14 +1511,15 @@ def hardcoded_tcl_config(self):

def add_flags(self, ext):
if sys.platform == 'win32':
ext.include_dirs.extend([setupwin.tcl_config_dir()])
major, minor1, minor2, s, tmp = sys.version_info
if sys.version_info[0:2] < (3, 4):
ext.include_dirs.extend(['win32_static/include/tcl85'])
ext.libraries.extend(['tk85', 'tcl85'])
else:
ext.include_dirs.extend(['win32_static/include/tcl86'])
ext.libraries.extend(['tk86t', 'tcl86t'])
ext.library_dirs.extend([os.path.join(sys.prefix, 'dlls')])
ext.library_dirs.extend([os.path.join(sys.prefix, 'tcl')])

elif sys.platform == 'darwin':
# this config section lifted directly from Imaging - thanks to
Expand Down
35 changes: 35 additions & 0 deletions setupwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import sys
import platform
import os
import glob
import shutil
import zipfile
import tarfile
import distutils.msvc9compiler as msvc
Expand Down Expand Up @@ -67,6 +69,39 @@ def config_dir():
segment = 'msvcr{}-x{}'.format('100' if VS2010 else '90', '64' if X64 else '32')
return os.path.join(DEPSDIR, segment)

def tcl_config_dir():
return os.path.join(config_dir(), 'tcl85', 'include')

def build_tcl():
inclib = config_dir()
tcl_inclib = tcl_config_dir()
if not os.path.exists(tcl_inclib):
os.makedirs(tcl_inclib)
tcl_inclib_x11 = os.path.join(tcl_inclib, 'X11')
if not os.path.exists(tcl_inclib_x11):
os.makedirs(tcl_inclib_x11)

distfile = os.path.join(DEPSDIR, 'tcl8513-src.zip')
compfile = os.path.join(tcl_inclib, 'tcl.h')
if not os.path.exists(compfile) or os.path.getmtime(distfile) > os.path.getmtime(compfile):
zip_extract(distfile, DEPSDIR)
targetdir = os.path.join(DEPSDIR, 'tcl8.5.13')
headers = glob.glob(os.path.join(targetdir, 'generic', '*.h'))
for filename in headers:
shutil.copy(filename, tcl_inclib)

distfile = os.path.join(DEPSDIR, 'tk8513-src.zip')
compfile = os.path.join(tcl_inclib, 'tk.h')
if not os.path.exists(compfile) or os.path.getmtime(distfile) > os.path.getmtime(compfile):
zip_extract(distfile, DEPSDIR)
targetdir = os.path.join(DEPSDIR, 'tk8.5.13')
headers = glob.glob(os.path.join(targetdir, 'generic', '*.h'))
for filename in headers:
shutil.copy(filename, tcl_inclib)
headers = glob.glob(os.path.join(targetdir, 'xlib', 'X11', '*.*'))
for filename in headers:
shutil.copy(filename, tcl_inclib_x11)

ZLIB_BUILD_CMD = """\
@ECHO OFF
REM call "%ProgramFiles%\\Microsoft SDKs\\Windows\\v7.0\\Bin\\SetEnv.Cmd" /Release /{xXX} /xp
Expand Down
0