summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2016-06-17 18:09:03 -0500
committerAdam J. Stewart <ajstewart426@gmail.com>2016-06-17 18:09:03 -0500
commit652a5eb5924415bd7d8c9d568f33f7dab211d998 (patch)
treea5c1e46e7a6f21ca83b2c8c64858f9c2d6334538 /var
parent62b2f2a7c9d54fb864e6aae91f1f47a1b35d1828 (diff)
downloadspack-652a5eb5924415bd7d8c9d568f33f7dab211d998.tar.gz
spack-652a5eb5924415bd7d8c9d568f33f7dab211d998.tar.bz2
spack-652a5eb5924415bd7d8c9d568f33f7dab211d998.tar.xz
spack-652a5eb5924415bd7d8c9d568f33f7dab211d998.zip
Allow py-pillow to link to Spack-built libraries
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/py-pillow/package.py136
1 files changed, 86 insertions, 50 deletions
diff --git a/var/spack/repos/builtin/packages/py-pillow/package.py b/var/spack/repos/builtin/packages/py-pillow/package.py
index cdbc57e0a5..5784b9f181 100644
--- a/var/spack/repos/builtin/packages/py-pillow/package.py
+++ b/var/spack/repos/builtin/packages/py-pillow/package.py
@@ -23,77 +23,113 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
-import os
+
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"
+ version('3.2.0', '7cfd093c11205d9e2ebe3c51dfcad510')
version('3.0.0', 'fc8ac44e93da09678eac7e30c9b7377d')
- provides('PIL')
# These defaults correspond to Pillow defaults
- variant('jpeg', default=True, description='Provide JPEG functionality')
- variant('zlib', default=True, description='Access to compressed PNGs')
- variant('tiff', default=False, description='Access to TIFF files')
+ variant('jpeg', default=True, description='Provide JPEG functionality')
+ variant('zlib', default=True, description='Access to compressed PNGs')
+ variant('tiff', default=False, description='Access to TIFF files')
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('tk', default=False, description='Support for tkinter bitmap and photo images')
+ variant('jpeg2000', default=False, description='Provide JPEG 2000 functionality')
# Spack does not (yet) support these modes of building
- # variant('webp', default=False, description='')
- # variant('webpmux', default=False, description='')
- # variant('jpeg2000', default=False, description='')
+ # variant('webp', default=False, description='Provide the WebP format')
+ # variant('webpmux', default=False, description='WebP metadata, relies on WebP support')
+ # variant('imagequant', default=False, description='Provide improved color quantization')
+
+ provides('PIL')
+ # Required dependencies
extends('python')
- depends_on('binutils')
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('tiff', when='+tiff')
+
+ # Optional dependencies
+ depends_on('libtiff', when='+tiff')
depends_on('freetype', when='+freetype')
- depends_on('lcms', when='+lcms')
- depends_on('tcl', when='+tk')
- depends_on('tk', when='+tk')
+ depends_on('lcms', when='+lcms')
+ depends_on('tcl', when='+tk')
+ depends_on('tk', when='+tk')
+ depends_on('openjpeg', when='+jpeg2000')
- def install(self, spec, prefix):
- libpath=[]
+ # Spack does not (yet) support these modes of building
+ # 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:
- 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:
- 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:
- 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:
- 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:
- libpath.append(join_path(spec['lcms'].prefix, 'lib'))
-
- # This has not been tested, and likely needs some other treatment.
- #if '+tk' in spec:
- # libpath.append(join_path(spec['tcl'].prefix, 'lib'))
- # libpath.append(join_path(spec['tk'].prefix, 'lib'))
-
- # -------- Building
- cmd = ['build_ext',
- '--%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:
- # cmd.extend(['--enable-tcl', '--enable-tk'])
- #else:
- # cmd.extend(['--disable-tcl', '--disable-tk'])
-
- # --------- Installation
- cmd.extend(['install', '--prefix=%s' % prefix])
-
- python('setup.py', *cmd)
+ setup.filter('LCMS_ROOT = None',
+ 'LCMS_ROOT = ("{0}", "{1}")'.format(
+ spec['lcms'].prefix.lib,
+ spec['lcms'].prefix.include))
+ if '+tk' in spec:
+ setup.filter('TCL_ROOT = None',
+ 'TCL_ROOT = ("{0}", "{1}")'.format(
+ spec['tcl'].prefix.lib,
+ spec['tcl'].prefix.include))
+ if '+jpeg2000' in spec:
+ setup.filter('JPEG2K_ROOT = None',
+ 'JPEG2K_ROOT = ("{0}", "{1}")'.format(
+ spec['openjpeg'].prefix.lib,
+ spec['openjpeg'].prefix.include))
+
+ def install(self, spec, prefix):
+ build_args = [
+ '--{0}-jpeg'.format('enable' if '+jpeg' in spec else 'disable'),
+ '--{0}-zlib'.format('enable' if '+zlib' in spec else 'disable'),
+ '--{0}-tiff'.format('enable' if '+tiff' in spec else 'disable'),
+ '--{0}-freetype'.format(
+ 'enable' if '+freetype' in spec else 'disable'),
+ '--{0}-lcms'.format('enable' if '+lcms' in spec else 'disable'),
+ '--{0}-tk'.format('enable' if '+tk' in spec else 'disable'),
+ '--{0}-tcl'.format('enable' if '+tk' in spec else 'disable'),
+ '--{0}-jpeg2000'.format(
+ 'enable' if '+jpeg2000' in spec else 'disable')
+ ]
+
+ python('setup.py', 'build_ext', *build_args)
+ python('setup.py', 'install', '--prefix={0}'.format(prefix))