Compiling MPL with WXAgg

Hi all (particularly John),

I just compiled mpl on Linux Fedora core 4 with wxAGG support. In doing so, I got tripped up, for a little bit, with wx-config.

Once I figured it out, I ended up re-arranging the build_wxagg function a bit, just so that more meaning full error messages are likely.

The big difference is that even if WXAgg is on auto, you still get the message about wx-config. Here's my version of build_wxagg, and I've enclosed the whole file if you want to diff it. Perhaps you'd like to role these changes in.

-Chris

def build_wxagg(ext_modules, packages, numerix, abortOnFailure):
     global BUILT_WXAGG
     if BUILT_WXAGG:
         return

     wxconfig = find_wx_config()

     # Avoid aborting the whole build process if `wx-config' can't be found and
     # BUILD_WXAGG in setup.py is set to "auto"
     if wxconfig is None:
         print """
WXAgg's accelerator requires `wx-config'.

The `wx-config\' executable could not be located in any directory of the
PATH environment variable. If you want to build WXAgg, and wx-config is
in some other location or has some other name, set the WX_CONFIG
environment variable to the full path of the executable like so:

export WX_CONFIG=/usr/lib/wxPython-2.6.1.0-gtk2-unicode/bin/wx-config
"""
         if not abortOnFailure:
             print """Building MPL without wxAgg"""
             BUILT_WXAGG = True
             return
         else:
             sys.exit(1)
     elif not check_wxpython_headers(wxconfig):
         print 'WXAgg\'s accelerator requires the wxPython headers.'

         if not abortOnFailure:
             BUILT_WXAGG = True
             return
         else:
             print """
The wxPython header files could not be located in any of the standard include
directories or include directories reported by `wx-config --cppflags'."""
             sys.exit(1)

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

     module = Extension('matplotlib.backends._wxagg', deps)

     add_agg_flags(module)
     add_ft2font_flags(module)
     add_wx_flags(module, wxconfig)

     ext_modules.append(module)
     BUILT_WXAGG = True

setupext.py (26.1 KB)

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...