Skip to content

Commit 43c30f0

Browse files
committed
added Kens wxconfig patch
svn path=/trunk/matplotlib/; revision=1743
1 parent 885fb29 commit 43c30f0

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

examples/strip_chart.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

setupext.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,24 @@ def find_wx_config():
214214
return None
215215

216216

217+
def check_wxpython_headers(wxconfig):
218+
"""Determines if wxPython.h can be found in one of the wxWidgets include
219+
directories.
220+
"""
221+
222+
flags = getoutput(wxconfig + ' --cppflags').split()
223+
incdirs = [os.path.join(p, 'include') for p in basedir[sys.platform]
224+
if os.path.exists(p)]
225+
226+
incdirs += [x[2:] for x in flags if x.startswith('-I')]
227+
header = os.path.join('wx', 'wxPython', 'wxPython.h')
228+
229+
for d in incdirs:
230+
if os.path.exists(os.path.join(d, header)):
231+
return True
232+
return False
233+
234+
217235
def add_wx_flags(module, wxconfig):
218236
"""
219237
Add the module flags to build extensions which use wxPython.
@@ -230,7 +248,7 @@ def getWX(fmt, *args):
230248
module.include_dirs.extend(
231249
[x[2:] for x in wxFlags if x.startswith('-I')])
232250

233-
print 'wxflags', wxFlags
251+
234252
module.define_macros.extend(
235253
[(x[2:], None) for x in wxFlags if x.startswith('-D')])
236254
module.undef_macros.extend(
@@ -473,6 +491,17 @@ def build_wxagg(ext_modules, packages, numerix, abortOnFailure):
473491
environment variable. If it is in some other location or has some other name,
474492
set the WX_CONFIG environment variable to the full path of the execuatable.'''
475493
sys.exit(1)
494+
elif not check_wxpython_headers(wxconfig):
495+
print 'WXAgg\'s accelerator requires the wxPython headers.'
496+
497+
if not abortOnFailure:
498+
BUILT_WXAGG = True
499+
return
500+
else:
501+
print '''\n\
502+
The wxPython header files could not be located in any of the standard include
503+
directories or include directories reported by `wx-config --cppflags'.'''
504+
sys.exit(1)
476505

477506
deps = ['src/_wxagg.cpp', 'src/mplutils.cpp', 'src/_transforms.cpp']
478507
deps.extend(glob.glob('CXX/*.cxx'))

0 commit comments

Comments
 (0)