Skip to content

Commit 0ecfa48

Browse files
committed
Added support for X-11 Tcl/Tk on Mac OS-X.
Added default location for tk includes. svn path=/trunk/matplotlib/; revision=323
1 parent 5e50560 commit 0ecfa48

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

setupext.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@
3232
import os
3333

3434
basedir = {
35-
3635
'win32' : ['win32_static',],
3736
'linux2' : ['/usr/local', '/usr',],
3837
'linux' : ['/usr/local', '/usr',],
39-
'darwin' : ['/usr/local', '/usr', '/sw'],
38+
'darwin' : [os.getenv('MBLIB_BASE') or '/usr/local', '/usr', '/sw'],
4039
'sunos5' : [os.getenv('MPLIB_BASE') or '/usr/local',],
4140
}
4241

@@ -59,7 +58,6 @@
5958
BUILT_TKAGG = False
6059
BUILT_WINDOWING = False
6160

62-
6361
def add_base_flags(module):
6462
incdirs = [os.path.join(p, 'include') for p in basedir[sys.platform]
6563
if os.path.exists(p)]
@@ -184,6 +182,7 @@ def find_tcltk():
184182
o.tcl_lib = "/usr/local/lib"
185183
o.tcl_inc = "/usr/local/include"
186184
o.tk_lib = "/usr/local/lib"
185+
o.tk_inc = "/usr/local/include"
187186
o.tkv = ""
188187
else:
189188
tk.withdraw()
@@ -212,14 +211,16 @@ def add_tk_flags(module):
212211
module.include_dirs.extend(['win32_static/include/tcl'])
213212
module.library_dirs.extend(['C:/Python23/dlls'])
214213
module.libraries.extend(['tk84', 'tcl84'])
215-
elif sys.platform == 'darwin':
216-
module.extra_link_args.extend(['-framework','Tcl'])
217-
module.extra_link_args.extend(['-framework','Tk'])
218214
else:
219-
o = find_tcltk()
220-
module.include_dirs.extend([o.tcl_inc, o.tk_inc])
221-
module.library_dirs.extend([o.tcl_lib, o.tk_lib])
222-
module.libraries.extend(['tk'+o.tkv, 'tcl'+o.tkv])
215+
o = find_tcltk()
216+
if sys.platform == 'darwin' and '/Library/Framework' in o.tk_lib:
217+
module.extra_link_args.extend(['-framework','Tcl'])
218+
module.extra_link_args.extend(['-framework','Tk'])
219+
else:
220+
module.include_dirs.extend([o.tcl_inc, o.tk_inc])
221+
module.library_dirs.extend([o.tcl_lib, o.tk_lib])
222+
module.libraries.extend(['tk'+o.tkv, 'tcl'+o.tkv])
223+
223224

224225
def add_windowing_flags(module):
225226
'Add the module flags to build extensions using windowing api'

src/_tkagg.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616

1717
extern "C" {
1818
#ifdef __APPLE__
19-
# include <Tcl/tcl.h>
20-
# include <Tk/tk.h>
19+
# ifdef TK_FRAMEWORK
20+
# include <Tcl/tcl.h>
21+
# include <Tk/tk.h>
22+
# else
23+
# include <tk.h>
24+
# endif
2125
#else
2226
# include <tk.h>
2327
#endif

0 commit comments

Comments
 (0)