Merge pull request #1078 from adamjstewart/features/pillow

Allow py-pillow to link to Spack-built libraries
This commit is contained in:
Todd Gamblin 2016-06-22 01:11:25 -07:00 committed by GitHub
commit e41d67e031
5 changed files with 92 additions and 49 deletions

View file

@ -24,6 +24,7 @@
############################################################################## ##############################################################################
from spack import * from spack import *
class Openjpeg(Package): class Openjpeg(Package):
""" """
OpenJPEG is an open-source JPEG 2000 codec written in C language. OpenJPEG is an open-source JPEG 2000 codec written in C language.
@ -36,12 +37,13 @@ class Openjpeg(Package):
homepage = "https://github.com/uclouvain/openjpeg" homepage = "https://github.com/uclouvain/openjpeg"
url = "https://github.com/uclouvain/openjpeg/archive/version.2.1.tar.gz" url = "https://github.com/uclouvain/openjpeg/archive/version.2.1.tar.gz"
version('2.1' , '3e1c451c087f8462955426da38aa3b3d') version('2.1', '3e1c451c087f8462955426da38aa3b3d')
version('2.0.1', '105876ed43ff7dbb2f90b41b5a43cfa5') version('2.0.1', '105876ed43ff7dbb2f90b41b5a43cfa5')
version('2.0' , 'cdf266530fee8af87454f15feb619609') version('2.0', 'cdf266530fee8af87454f15feb619609')
version('1.5.2', '545f98923430369a6b046ef3632ef95c') version('1.5.2', '545f98923430369a6b046ef3632ef95c')
version('1.5.1', 'd774e4b5a0db5f0f171c4fc0aabfa14e') version('1.5.1', 'd774e4b5a0db5f0f171c4fc0aabfa14e')
depends_on('cmake')
def install(self, spec, prefix): def install(self, spec, prefix):
cmake('.', *std_cmake_args) cmake('.', *std_cmake_args)

View file

@ -23,10 +23,12 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
from spack import * from spack import *
import os
class PyBasemap(Package): class PyBasemap(Package):
"""The matplotlib basemap toolkit is a library for plotting 2D data on maps in Python.""" """The matplotlib basemap toolkit is a library for plotting
2D data on maps in Python."""
homepage = "http://matplotlib.org/basemap/" homepage = "http://matplotlib.org/basemap/"
url = "https://downloads.sourceforge.net/project/matplotlib/matplotlib-toolkits/basemap-1.0.7/basemap-1.0.7.tar.gz" url = "https://downloads.sourceforge.net/project/matplotlib/matplotlib-toolkits/basemap-1.0.7/basemap-1.0.7.tar.gz"
@ -36,7 +38,7 @@ class PyBasemap(Package):
depends_on('py-setuptools') depends_on('py-setuptools')
depends_on('py-numpy') depends_on('py-numpy')
depends_on('py-matplotlib+gui') depends_on('py-matplotlib+gui')
depends_on('py-pillow') depends_on('pil')
depends_on("geos") depends_on("geos")
def install(self, spec, prefix): def install(self, spec, prefix):

View file

@ -24,14 +24,19 @@
############################################################################## ##############################################################################
from spack import * from spack import *
class PyPil(Package): class PyPil(Package):
"""The Python Imaging Library (PIL) adds image processing capabilities to your Python interpreter. This library supports many file formats, and provides powerful image processing and graphics capabilities.""" """The Python Imaging Library (PIL) adds image processing capabilities
to your Python interpreter. This library supports many file formats,
and provides powerful image processing and graphics capabilities."""
homepage = "http://www.pythonware.com/products/pil/" homepage = "http://www.pythonware.com/products/pil/"
url = "http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz" url = "http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz"
version('1.1.7', 'fc14a54e1ce02a0225be8854bfba478e') version('1.1.7', 'fc14a54e1ce02a0225be8854bfba478e')
provides('pil')
extends('python') extends('python')
def install(self, spec, prefix): def install(self, spec, prefix):

View file

@ -23,77 +23,108 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
from spack import * from spack import *
import os
class PyPillow(Package): class PyPillow(Package):
"""Pillow is the friendly PIL fork by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lundh and Contributors. The Python Imaging Library (PIL) adds image processing capabilities to your Python interpreter. This library supports many file formats, and provides powerful image processing and graphics capabilities.""" """Pillow is a fork of the Python Imaging Library (PIL). It adds image
processing capabilities to your Python interpreter. This library supports
many file formats, and provides powerful image processing and graphics
capabilities."""
homepage = "https://python-pillow.github.io/" homepage = "https://python-pillow.org/"
url = "https://pypi.python.org/packages/source/P/Pillow/Pillow-3.0.0.tar.gz" url = "https://pypi.python.org/packages/source/P/Pillow/Pillow-3.0.0.tar.gz"
# TODO: This version should be deleted once the next release comes out.
# TODO: It fixes a bug that prevented us from linking to Tk/Tcl.
# TODO: Tk/Tcl support is necessary for tkinter bitmap and photo images.
# TODO: If you require this support, run the following command:
# TODO: `spack install py-pillow@3.3.0.dev0 ^python+tk`
version('3.3.0.dev0', git='https://github.com/python-pillow/Pillow.git',
commit='30eced62868141a6c859a4370efd40b9434a7c3f')
version('3.2.0', '7cfd093c11205d9e2ebe3c51dfcad510', preferred=True)
version('3.0.0', 'fc8ac44e93da09678eac7e30c9b7377d') version('3.0.0', 'fc8ac44e93da09678eac7e30c9b7377d')
provides('PIL')
provides('pil')
# These defaults correspond to Pillow defaults # These defaults correspond to Pillow defaults
variant('jpeg', default=True, description='Provide JPEG functionality') variant('jpeg', default=True, description='Provide JPEG functionality')
variant('zlib', default=True, description='Access to compressed PNGs') variant('zlib', default=True, description='Access to compressed PNGs')
variant('tiff', default=False, description='Access to TIFF files') variant('tiff', default=False, description='Access to TIFF files')
variant('freetype', default=False, description='Font related services') variant('freetype', default=False, description='Font related services')
variant('tk', default=False, description='Support for tkinter bitmap and photo images')
variant('lcms', default=False, description='Color management') variant('lcms', default=False, description='Color management')
variant('jpeg2000', default=False, description='Provide JPEG 2000 functionality')
# Spack does not (yet) support these modes of building # Spack does not (yet) support these modes of building
# variant('webp', default=False, description='') # variant('webp', default=False, description='Provide the WebP format')
# variant('webpmux', default=False, description='') # variant('webpmux', default=False, description='WebP metadata, relies on WebP support') # NOQA: ignore=E501
# variant('jpeg2000', default=False, description='') # variant('imagequant', default=False, description='Provide improved color quantization') # NOQA: ignore=E501
# Required dependencies
extends('python') extends('python')
depends_on('binutils') depends_on('binutils')
depends_on('py-setuptools') depends_on('py-setuptools')
depends_on('jpeg', when='+jpeg') # BUG: It will use the system libjpeg anyway # Recommended dependencies
depends_on('jpeg', when='+jpeg')
depends_on('zlib', when='+zlib') depends_on('zlib', when='+zlib')
depends_on('tiff', when='+tiff')
# Optional dependencies
depends_on('libtiff', when='+tiff')
depends_on('freetype', when='+freetype') depends_on('freetype', when='+freetype')
depends_on('lcms', when='+lcms') depends_on('lcms', when='+lcms')
depends_on('tcl', when='+tk') depends_on('openjpeg', when='+jpeg2000')
depends_on('tk', when='+tk')
def install(self, spec, prefix): # Spack does not (yet) support these modes of building
libpath=[] # depends_on('webp', when='+webp')
# depends_on('webpmux', when='+webpmux')
# depends_on('imagequant', when='+imagequant')
def patch(self):
"""Patch setup.py to provide lib and include directories
for dependencies."""
spec = self.spec
setup = FileFilter('setup.py')
if '+jpeg' in spec: if '+jpeg' in spec:
libpath.append(join_path(spec['jpeg'].prefix, 'lib')) setup.filter('JPEG_ROOT = None',
'JPEG_ROOT = ("{0}", "{1}")'.format(
spec['jpeg'].prefix.lib,
spec['jpeg'].prefix.include))
if '+zlib' in spec: if '+zlib' in spec:
libpath.append(join_path(spec['zlib'].prefix, 'lib')) setup.filter('ZLIB_ROOT = None',
'ZLIB_ROOT = ("{0}", "{1}")'.format(
spec['zlib'].prefix.lib,
spec['zlib'].prefix.include))
if '+tiff' in spec: if '+tiff' in spec:
libpath.append(join_path(spec['tiff'].prefix, 'lib')) setup.filter('TIFF_ROOT = None',
'TIFF_ROOT = ("{0}", "{1}")'.format(
spec['libtiff'].prefix.lib,
spec['libtiff'].prefix.include))
if '+freetype' in spec: if '+freetype' in spec:
libpath.append(join_path(spec['freetype'].prefix, 'lib')) setup.filter('FREETYPE_ROOT = None',
'FREETYPE_ROOT = ("{0}", "{1}")'.format(
spec['freetype'].prefix.lib,
spec['freetype'].prefix.include))
if '+lcms' in spec: if '+lcms' in spec:
libpath.append(join_path(spec['lcms'].prefix, 'lib')) setup.filter('LCMS_ROOT = None',
'LCMS_ROOT = ("{0}", "{1}")'.format(
spec['lcms'].prefix.lib,
spec['lcms'].prefix.include))
if '+jpeg2000' in spec:
setup.filter('JPEG2K_ROOT = None',
'JPEG2K_ROOT = ("{0}", "{1}")'.format(
spec['openjpeg'].prefix.lib,
spec['openjpeg'].prefix.include))
# This has not been tested, and likely needs some other treatment. def install(self, spec, prefix):
#if '+tk' in spec: def variant_to_flag(variant):
# libpath.append(join_path(spec['tcl'].prefix, 'lib')) able = 'enable' if '+{0}'.format(variant) in spec else 'disable'
# libpath.append(join_path(spec['tk'].prefix, 'lib')) return '--{0}-{1}'.format(able, variant)
# -------- Building variants = ['jpeg', 'zlib', 'tiff', 'freetype', 'lcms', 'jpeg2000']
cmd = ['build_ext', build_args = list(map(variant_to_flag, variants))
'--%s-jpeg' % ('enable' if '+jpeg' in spec else 'disable'),
'--%s-zlib' % ('enable' if '+zlib' in spec else 'disable'),
'--%s-tiff' % ('enable' if '+tiff' in spec else 'disable'),
'--%s-freetype' % ('enable' if '+freetype' in spec else 'disable'),
'--%s-lcms' % ('enable' if '+lcms' in spec else 'disable'),
'-L'+':'.join(libpath) # NOTE: This does not make it find libjpeg
]
#if '+tk' in spec: python('setup.py', 'build_ext', *build_args)
# cmd.extend(['--enable-tcl', '--enable-tk']) python('setup.py', 'install', '--prefix={0}'.format(prefix))
#else:
# cmd.extend(['--disable-tcl', '--disable-tk'])
# --------- Installation
cmd.extend(['install', '--prefix=%s' % prefix])
python('setup.py', *cmd)

View file

@ -24,8 +24,11 @@
############################################################################## ##############################################################################
from spack import * from spack import *
class PyScikitImage(Package): class PyScikitImage(Package):
"""Image processing algorithms for SciPy, including IO, morphology, filtering, warping, color manipulation, object detection, etc.""" """Image processing algorithms for SciPy, including IO, morphology,
filtering, warping, color manipulation, object detection, etc."""
homepage = "http://scikit-image.org/" homepage = "http://scikit-image.org/"
url = "https://pypi.python.org/packages/source/s/scikit-image/scikit-image-0.12.3.tar.gz" url = "https://pypi.python.org/packages/source/s/scikit-image/scikit-image-0.12.3.tar.gz"
@ -34,7 +37,7 @@ class PyScikitImage(Package):
extends('python', ignore=r'bin/.*\.py$') extends('python', ignore=r'bin/.*\.py$')
depends_on('py-dask') depends_on('py-dask')
depends_on('py-pillow') depends_on('pil')
depends_on('py-networkx') depends_on('py-networkx')
depends_on('py-six') depends_on('py-six')
depends_on('py-scipy') depends_on('py-scipy')