summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-06-22 01:11:25 -0700
committerGitHub <noreply@github.com>2016-06-22 01:11:25 -0700
commite41d67e031aca9acabcae74d49ee486fc4d9b1c0 (patch)
tree244a4817bcf50e49c706c3cb90db217b25aaf8e4
parent8b5467e65dae2c49303280c8a71c925adfcc8827 (diff)
parenta7ffb2c1a4526acf11edbf121770adcb058fc228 (diff)
downloadspack-e41d67e031aca9acabcae74d49ee486fc4d9b1c0.tar.gz
spack-e41d67e031aca9acabcae74d49ee486fc4d9b1c0.tar.bz2
spack-e41d67e031aca9acabcae74d49ee486fc4d9b1c0.tar.xz
spack-e41d67e031aca9acabcae74d49ee486fc4d9b1c0.zip
Merge pull request #1078 from adamjstewart/features/pillow
Allow py-pillow to link to Spack-built libraries
-rw-r--r--var/spack/repos/builtin/packages/openjpeg/package.py6
-rw-r--r--var/spack/repos/builtin/packages/py-basemap/package.py8
-rw-r--r--var/spack/repos/builtin/packages/py-pil/package.py7
-rw-r--r--var/spack/repos/builtin/packages/py-pillow/package.py119
-rw-r--r--var/spack/repos/builtin/packages/py-scikit-image/package.py7
5 files changed, 95 insertions, 52 deletions
diff --git a/var/spack/repos/builtin/packages/openjpeg/package.py b/var/spack/repos/builtin/packages/openjpeg/package.py
index 9b2063593a..1d00edb06d 100644
--- a/var/spack/repos/builtin/packages/openjpeg/package.py
+++ b/var/spack/repos/builtin/packages/openjpeg/package.py
@@ -24,6 +24,7 @@
##############################################################################
from spack import *
+
class Openjpeg(Package):
"""
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"
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' , 'cdf266530fee8af87454f15feb619609')
+ version('2.0', 'cdf266530fee8af87454f15feb619609')
version('1.5.2', '545f98923430369a6b046ef3632ef95c')
version('1.5.1', 'd774e4b5a0db5f0f171c4fc0aabfa14e')
+ depends_on('cmake')
def install(self, spec, prefix):
cmake('.', *std_cmake_args)
diff --git a/var/spack/repos/builtin/packages/py-basemap/package.py b/var/spack/repos/builtin/packages/py-basemap/package.py
index 95d02bce91..13f604bacd 100644
--- a/var/spack/repos/builtin/packages/py-basemap/package.py
+++ b/var/spack/repos/builtin/packages/py-basemap/package.py
@@ -23,10 +23,12 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
-import os
+
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/"
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-numpy')
depends_on('py-matplotlib+gui')
- depends_on('py-pillow')
+ depends_on('pil')
depends_on("geos")
def install(self, spec, prefix):
diff --git a/var/spack/repos/builtin/packages/py-pil/package.py b/var/spack/repos/builtin/packages/py-pil/package.py
index dc4418fdfe..2b3cce26d3 100644
--- a/var/spack/repos/builtin/packages/py-pil/package.py
+++ b/var/spack/repos/builtin/packages/py-pil/package.py
@@ -24,14 +24,19 @@
##############################################################################
from spack import *
+
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/"
url = "http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz"
version('1.1.7', 'fc14a54e1ce02a0225be8854bfba478e')
+ provides('pil')
+
extends('python')
def install(self, spec, prefix):
diff --git a/var/spack/repos/builtin/packages/py-pillow/package.py b/var/spack/repos/builtin/packages/py-pillow/package.py
index cdbc57e0a5..25cf412b31 100644
--- a/var/spack/repos/builtin/packages/py-pillow/package.py
+++ b/var/spack/repos/builtin/packages/py-pillow/package.py
@@ -23,77 +23,108 @@
# 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"
+ # 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')
- provides('PIL')
+
+ 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('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('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') # NOQA: ignore=E501
+ # variant('imagequant', default=False, description='Provide improved color quantization') # NOQA: ignore=E501
+ # 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('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 '+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):
+ def variant_to_flag(variant):
+ able = 'enable' if '+{0}'.format(variant) in spec else 'disable'
+ return '--{0}-{1}'.format(able, variant)
+
+ variants = ['jpeg', 'zlib', 'tiff', 'freetype', 'lcms', 'jpeg2000']
+ build_args = list(map(variant_to_flag, variants))
+
+ python('setup.py', 'build_ext', *build_args)
+ python('setup.py', 'install', '--prefix={0}'.format(prefix))
diff --git a/var/spack/repos/builtin/packages/py-scikit-image/package.py b/var/spack/repos/builtin/packages/py-scikit-image/package.py
index 0479e9eb0a..4c8fd0942a 100644
--- a/var/spack/repos/builtin/packages/py-scikit-image/package.py
+++ b/var/spack/repos/builtin/packages/py-scikit-image/package.py
@@ -24,8 +24,11 @@
##############################################################################
from spack import *
+
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/"
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$')
depends_on('py-dask')
- depends_on('py-pillow')
+ depends_on('pil')
depends_on('py-networkx')
depends_on('py-six')
depends_on('py-scipy')