Update matplotlibrc filtering for GUI backends

This commit is contained in:
Adam J. Stewart 2016-08-03 12:35:09 -05:00
parent a388871083
commit 8a0824df09
2 changed files with 10 additions and 10 deletions

View file

@ -80,19 +80,17 @@ def install(self, spec, prefix):
setup_py('build')
setup_py('install', '--prefix={0}'.format(prefix))
if str(self.version) in ['1.4.2', '1.4.3']:
# hack to fix configuration file
if '+gui' in spec:
# Set backend in matplotlib configuration file
config_file = None
for p, d, f in os.walk(prefix.lib):
for file in f:
if file.find('matplotlibrc') != -1:
config_file = join_path(p, 'matplotlibrc')
print config_file
if not config_file:
raise InstallError('could not find config file')
filter_file(r'backend : pyside',
'backend : Qt4Agg',
config_file)
filter_file(r'#backend.qt4 : PyQt4',
'backend.qt4 : PySide',
config_file)
raise InstallError('Could not find matplotlibrc')
kwargs = {'ignore_absent': False, 'backup': False, 'string': False}
rc = FileFilter(config_file)
rc.filter('^backend.*', 'backend : Qt4Agg', **kwargs)
rc.filter('^#backend.qt4.*', 'backend.qt4 : PySide', **kwargs)

View file

@ -133,6 +133,8 @@ def install(self, spec, prefix):
# TODO: Once better testing support is integrated, add the following tests
# https://wiki.python.org/moin/TkInter
#
# Note: Only works if ForwardX11Trusted is enabled, i.e. `ssh -Y`
#
# if '+tk' in spec:
# env['TK_LIBRARY'] = join_path(spec['tk'].prefix.lib,
# 'tk{0}'.format(spec['tk'].version.up_to(2)))