diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2017-01-17 01:36:03 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2017-01-17 01:36:03 -0800 |
commit | 52a9e5d2a31b4a66ce51d0ff03ab709417dee6dc (patch) | |
tree | ef8216231785feaf7ee3f2d037f4240bdd115be8 /var/spack/repos/builtin/packages/py-matplotlib/package.py | |
parent | 4f8167b7ed8fe156e1f350aaa37230ab07a27895 (diff) | |
parent | 18563177775509286e5b53744ea5924bc450d9c2 (diff) | |
download | spack-52a9e5d2a31b4a66ce51d0ff03ab709417dee6dc.tar.gz spack-52a9e5d2a31b4a66ce51d0ff03ab709417dee6dc.tar.bz2 spack-52a9e5d2a31b4a66ce51d0ff03ab709417dee6dc.tar.xz spack-52a9e5d2a31b4a66ce51d0ff03ab709417dee6dc.zip |
Merge branch 'releases/v0.10.0'v0.10.0
Diffstat (limited to 'var/spack/repos/builtin/packages/py-matplotlib/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/py-matplotlib/package.py | 121 |
1 files changed, 82 insertions, 39 deletions
diff --git a/var/spack/repos/builtin/packages/py-matplotlib/package.py b/var/spack/repos/builtin/packages/py-matplotlib/package.py index 14f9716ae6..d808b0fc4b 100644 --- a/var/spack/repos/builtin/packages/py-matplotlib/package.py +++ b/var/spack/repos/builtin/packages/py-matplotlib/package.py @@ -25,55 +25,98 @@ from spack import * import os -class PyMatplotlib(Package): - """Python plotting package.""" + +class PyMatplotlib(PythonPackage): + """matplotlib is a python 2D plotting library which produces publication + quality figures in a variety of hardcopy formats and interactive + environments across platforms.""" + homepage = "https://pypi.python.org/pypi/matplotlib" - url = "https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.2.tar.gz" + url = "https://pypi.io/packages/source/m/matplotlib/matplotlib-1.4.2.tar.gz" - version('1.4.2', '7d22efb6cce475025733c50487bd8898') + version('1.5.3', 'ba993b06113040fee6628d74b80af0fd') + version('1.5.1', 'f51847d8692cb63df64cd0bd0304fd20') version('1.4.3', '86af2e3e3c61849ac7576a6f5ca44267') + version('1.4.2', '7d22efb6cce475025733c50487bd8898') + + # See: http://matplotlib.org/users/installing.html - variant('gui', default=False, description='Enable GUI') + # Variants enabled by default for a standard configuration + variant('tk', default=True, description='Enable Tk GUI') + variant('image', default=True, + description='Enable reading/saving JPEG, BMP and TIFF files') + + # Variants optionally available to user variant('ipython', default=False, description='Enable ipython support') + variant('qt', default=False, description='Enable Qt GUI') + variant('latex', default=False, + description='Enable LaTeX text rendering support') + variant('animation', default=False, + description='Enable animation support') + # Python 2.7, 3.4, or 3.5 extends('python', ignore=r'bin/nosetests.*$|bin/pbr$') - depends_on('py-pyside', when='+gui') + # ------ Required dependencies + depends_on('py-setuptools', type='build') + + depends_on('libpng@1.2:') + depends_on('freetype@2.3:') + + depends_on('py-numpy@1.6:', type=('build', 'run')) + depends_on('py-dateutil@1.1:', type=('build', 'run')) + depends_on('py-pyparsing', type=('build', 'run')) + depends_on('py-pytz', type=('build', 'run')) + depends_on('py-cycler@0.9:', type=('build', 'run')) + + # ------ Optional GUI frameworks + depends_on('tk@8.3:', when='+tk') # not 8.6.0 or 8.6.1 + depends_on('qt', when='+qt') + depends_on('py-pyside', when='+qt', type=('build', 'run')) + + # --------- Optional external programs + # ffmpeg/avconv or mencoder + depends_on('image-magick', when='+animation') + + # --------- Optional dependencies + depends_on('pkg-config', type='build') # why not... + depends_on('pil', when='+image', type=('build', 'run')) depends_on('py-ipython', when='+ipython') - depends_on('py-pyparsing') - depends_on('py-six') - depends_on('py-dateutil') - depends_on('py-pytz') - depends_on('py-nose') - depends_on('py-numpy') - depends_on('py-mock') - depends_on('py-pbr') - depends_on('py-funcsigs') - - depends_on('pkg-config') - depends_on('freetype') - depends_on('qt', when='+gui') - depends_on('bzip2') - depends_on('tcl', when='+gui') - depends_on('tk', when='+gui') - depends_on('qhull') - - def install(self, spec, prefix): - python('setup.py', 'install', '--prefix=%s' % prefix) - - if str(self.version) in ['1.4.2', '1.4.3']: - # hack to fix configuration file + depends_on('ghostscript', when='+latex', type='run') + depends_on('texlive', when='+latex', type='run') + + # Testing dependencies + depends_on('py-nose') # type='test' + depends_on('py-mock') # type='test' + + # Required libraries that ship with matplotlib + # depends_on('agg@2.4:') + depends_on('qhull@2012.1:') + # depends_on('ttconv') + depends_on('py-six@1.9.0:', type=('build', 'run')) + + @PythonPackage.sanity_check('install') + def set_backend(self): + spec = self.spec + prefix = self.prefix + + if '+qt' in spec or '+tk' in spec: + # Set backend in matplotlib configuration file config_file = None - for p,d,f in os.walk(prefix.lib): + 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 config_file == None: - 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) + if not config_file: + raise InstallError('Could not find matplotlibrc') + + kwargs = {'ignore_absent': False, 'backup': False, 'string': False} + rc = FileFilter(config_file) + + # Only make Qt4 be the default backend if Tk is turned off + if '+qt' in spec and '+tk' not in spec: + rc.filter('^backend.*', 'backend : Qt4Agg', **kwargs) + + # Additional options in case user is doing Qt4: + if '+qt' in spec: + rc.filter('^#backend.qt4.*', 'backend.qt4 : PySide', **kwargs) |