diff options
19 files changed, 83 insertions, 48 deletions
diff --git a/etc/spack/defaults/packages.yaml b/etc/spack/defaults/packages.yaml index dcfbf76b51..ce1ee9c6b3 100644 --- a/etc/spack/defaults/packages.yaml +++ b/etc/spack/defaults/packages.yaml @@ -38,7 +38,7 @@ packages: mpi: [openmpi, mpich] mysql-client: [mysql, mariadb-c-client] opencl: [pocl] - pil: [py-pillow] + pil: [py-pillow-simd] pkgconfig: [pkgconf, pkg-config] rpc: [libtirpc] scalapack: [netlib-scalapack] diff --git a/var/spack/repos/builtin/packages/paraview/package.py b/var/spack/repos/builtin/packages/paraview/package.py index 018cc68290..98447c3c2d 100644 --- a/var/spack/repos/builtin/packages/paraview/package.py +++ b/var/spack/repos/builtin/packages/paraview/package.py @@ -115,7 +115,7 @@ class Paraview(CMakePackage, CudaPackage): # Can't contretize with python2 and py-setuptools@45.0.0: depends_on('py-setuptools@:44.99.99', when='+python') # Can't contretize with python2 and py-pillow@7.0.0: - depends_on('py-pillow@:6', when='+python') + depends_on('pil@:6', when='+python') patch('stl-reader-pv440.patch', when='@4.4.0') diff --git a/var/spack/repos/builtin/packages/py-bokeh/package.py b/var/spack/repos/builtin/packages/py-bokeh/package.py index 7497efc23b..7b42fde368 100644 --- a/var/spack/repos/builtin/packages/py-bokeh/package.py +++ b/var/spack/repos/builtin/packages/py-bokeh/package.py @@ -18,7 +18,7 @@ class PyBokeh(PythonPackage): depends_on('python@2.6:', type=('build', 'run'), when='@0.12.2') depends_on('python@2.7:', type=('build', 'run'), when='@1.3.4:') depends_on('py-requests@1.2.3:', type=('build', 'run'), when='@0.12.2') - depends_on('py-pillow@4.0:', type=('build', 'run'), when='@1.3.4:') + depends_on('pil@4.0:', type=('build', 'run'), when='@1.3.4:') depends_on('py-packaging@16.8:', type=('build', 'run'), when='@1.3.4:') depends_on('py-six@1.5.2:', type=('build', 'run')) depends_on('py-pyyaml@3.10:', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-cartopy/package.py b/var/spack/repos/builtin/packages/py-cartopy/package.py index 8c7a3f7a54..1d19b4da2d 100644 --- a/var/spack/repos/builtin/packages/py-cartopy/package.py +++ b/var/spack/repos/builtin/packages/py-cartopy/package.py @@ -42,10 +42,10 @@ class PyCartopy(PythonPackage): # Optional dependecies depends_on('py-pyepsg@0.4.0:', type=('build', 'run'), when='+epsg') depends_on('py-owslib@0.8.11:', type=('build', 'run'), when='+ows') - depends_on('py-pillow@1.7.8:', type=('build', 'run'), when='+ows') + depends_on('pil@1.7.8:', type=('build', 'run'), when='+ows') depends_on('py-matplotlib@1.5.1:', type=('build', 'run'), when='+plotting') depends_on('gdal@1.10.0:+python', type=('build', 'run'), when='+plotting') - depends_on('py-pillow@1.7.8:', type=('build', 'run'), when='+plotting') + depends_on('pil@1.7.8:', type=('build', 'run'), when='+plotting') depends_on('py-scipy@0.10:', type=('build', 'run'), when='+plotting') # Testing dependencies diff --git a/var/spack/repos/builtin/packages/py-gluoncv/package.py b/var/spack/repos/builtin/packages/py-gluoncv/package.py index 0596676654..a584605d28 100644 --- a/var/spack/repos/builtin/packages/py-gluoncv/package.py +++ b/var/spack/repos/builtin/packages/py-gluoncv/package.py @@ -24,7 +24,7 @@ class PyGluoncv(PythonPackage): depends_on('py-requests', type=('build', 'run')) depends_on('py-matplotlib', type=('build', 'run')) depends_on('py-portalocker', type=('build', 'run')) - depends_on('py-pillow', type=('build', 'run')) + depends_on('pil', type=('build', 'run')) depends_on('py-scipy', type=('build', 'run')) depends_on('py-cython', type='build') diff --git a/var/spack/repos/builtin/packages/py-guiqwt/package.py b/var/spack/repos/builtin/packages/py-guiqwt/package.py index 84a983473d..86cb35e37f 100644 --- a/var/spack/repos/builtin/packages/py-guiqwt/package.py +++ b/var/spack/repos/builtin/packages/py-guiqwt/package.py @@ -20,4 +20,4 @@ class PyGuiqwt(PythonPackage): depends_on('py-scipy@0.7:', type=('build', 'run')) depends_on('py-guidata@1.7.0:', type=('build', 'run')) depends_on('py-pythonqwt@0.5.0:', type=('build', 'run')) - depends_on('py-pillow', type=('build', 'run')) + depends_on('pil', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-imageio/package.py b/var/spack/repos/builtin/packages/py-imageio/package.py index 12111352d4..8dd09b1f3f 100644 --- a/var/spack/repos/builtin/packages/py-imageio/package.py +++ b/var/spack/repos/builtin/packages/py-imageio/package.py @@ -23,7 +23,7 @@ class PyImageio(PythonPackage): # Fix for python 2 if needed. depends_on('py-numpy', type=('build', 'run')) - depends_on('py-pillow', type=('build', 'run')) + depends_on('pil', type=('build', 'run')) depends_on('python@2.7:2.8,3.4:', type=('build', 'run')) depends_on('py-setuptools', type='build') depends_on('ffmpeg', type='run') diff --git a/var/spack/repos/builtin/packages/py-matplotlib/package.py b/var/spack/repos/builtin/packages/py-matplotlib/package.py index c4984b1ef8..81845b6bf1 100644 --- a/var/spack/repos/builtin/packages/py-matplotlib/package.py +++ b/var/spack/repos/builtin/packages/py-matplotlib/package.py @@ -93,7 +93,7 @@ class PyMatplotlib(PythonPackage): depends_on('py-python-dateutil@2.1:', type=('build', 'run')) depends_on('py-kiwisolver@1.0.1:', type=('build', 'run'), when='@2.2.0:') depends_on('py-pyparsing@2.0.3,2.0.5:2.1.1,2.1.3:2.1.5,2.1.7:', type=('build', 'run')) - depends_on('py-pillow@6.2.0:', when='@3.3:', type=('build', 'run')) + depends_on('pil@6.2.0:', when='@3.3:', type=('build', 'run')) depends_on('py-pytz', type=('build', 'run'), when='@:2') depends_on('py-subprocess32', type=('build', 'run'), when='^python@:2.7') depends_on('py-functools32', type=('build', 'run'), when='@:2.0.999 ^python@:2.7') @@ -127,7 +127,7 @@ class PyMatplotlib(PythonPackage): # Optional dependencies depends_on('ffmpeg', when='+movies') depends_on('imagemagick', when='+animation') - depends_on('py-pillow@3.4:', when='+image', type=('build', 'run')) + depends_on('pil@3.4:', when='+image', type=('build', 'run')) depends_on('texlive', when='+latex', type='run') depends_on('ghostscript@0.9:', when='+latex', type='run') depends_on('fontconfig@2.7:', when='+fonts') diff --git a/var/spack/repos/builtin/packages/py-openslide-python/package.py b/var/spack/repos/builtin/packages/py-openslide-python/package.py index a3e0e2c1d2..371b218cb3 100644 --- a/var/spack/repos/builtin/packages/py-openslide-python/package.py +++ b/var/spack/repos/builtin/packages/py-openslide-python/package.py @@ -19,4 +19,4 @@ class PyOpenslidePython(PythonPackage): depends_on('openslide@3.4.0:') depends_on('python@2.6:2.8,3.3:') depends_on('py-setuptools', type='build') - depends_on('py-pillow+jpeg+jpeg2000+tiff', type=('build', 'run')) + depends_on('py-pillow-simd+jpeg+jpeg2000+tiff', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-pauvre/package.py b/var/spack/repos/builtin/packages/py-pauvre/package.py index 679e6c0034..d022d882c4 100644 --- a/var/spack/repos/builtin/packages/py-pauvre/package.py +++ b/var/spack/repos/builtin/packages/py-pauvre/package.py @@ -18,4 +18,4 @@ class PyPauvre(PythonPackage): depends_on('py-matplotlib', type=('build', 'run')) depends_on('py-biopython', type=('build', 'run')) depends_on('py-pandas', type=('build', 'run')) - depends_on('py-pillow', type=('build', 'run')) + depends_on('pil', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-pil/package.py b/var/spack/repos/builtin/packages/py-pil/package.py index c248c9207f..0fd20fdb4c 100644 --- a/var/spack/repos/builtin/packages/py-pil/package.py +++ b/var/spack/repos/builtin/packages/py-pil/package.py @@ -3,8 +3,6 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * - class PyPil(PythonPackage): """The Python Imaging Library (PIL) adds image processing capabilities @@ -17,7 +15,8 @@ class PyPil(PythonPackage): version('1.1.7', sha256='895bc7c2498c8e1f9b99938f1a40dc86b3f149741f105cf7c7bd2e0725405211') provides('pil') + provides('pil@1.1.7', when='@1.1.7') # py-pil currently only works with Python2. # If you are using Python 3, try using py-pillow instead. - depends_on('python@1.5.2:2.8') + depends_on('python@1.5.2:2.8', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-pillow-simd/package.py b/var/spack/repos/builtin/packages/py-pillow-simd/package.py new file mode 100644 index 0000000000..183206adc1 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-pillow-simd/package.py @@ -0,0 +1,21 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.pkg.builtin.py_pillow import PyPillowBase + + +class PyPillowSimd(PyPillowBase): + """Pillow-SIMD is a SIMD-enabled fork of Pillow. It is usually 4-6x + faster than the original Pillow in image processing benchmarks.""" + + # See https://github.com/spack/spack/pull/15566 + _name = 'py-pillow-simd' + homepage = "https://github.com/uploadcare/pillow-simd" + url = "https://pypi.io/packages/source/P/Pillow-SIMD/Pillow-SIMD-7.0.0.post3.tar.gz" + + version('7.0.0.post3', sha256='c27907af0e7ede1ceed281719e722e7dbf3e1dbfe561373978654a6b64896cb7') + + for ver in ['7.0.0.post3']: + provides('pil@' + ver, when='@' + str(Version(ver).up_to(3))) diff --git a/var/spack/repos/builtin/packages/py-pillow/package.py b/var/spack/repos/builtin/packages/py-pillow/package.py index 32faff9956..b14e46a8e0 100644 --- a/var/spack/repos/builtin/packages/py-pillow/package.py +++ b/var/spack/repos/builtin/packages/py-pillow/package.py @@ -3,32 +3,12 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * - - -class PyPillow(PythonPackage): - """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.org/" - url = "https://pypi.io/packages/source/P/Pillow/Pillow-7.2.0.tar.gz" +class PyPillowBase(PythonPackage): + """Base class for Pillow and its fork Pillow-SIMD.""" maintainers = ['adamjstewart'] import_modules = ['PIL'] - version('7.2.0', sha256='97f9e7953a77d5a70f49b9a48da7776dc51e9b738151b22dacf101641594a626') - version('7.0.0', sha256='4d9ed9a64095e031435af120d3c910148067087541131e82b3e8db302f4c8946') - version('6.2.2', sha256='db9ff0c251ed066d367f53b64827cc9e18ccea001b986d08c265e53625dab950') - version('6.2.1', sha256='bf4e972a88f8841d8fdc6db1a75e0f8d763e66e3754b03006cbc3854d89f1cb1') - version('6.2.0', sha256='4548236844327a718ce3bb182ab32a16fa2050c61e334e959f554cac052fb0df') - version('6.0.0', sha256='809c0a2ce9032cbcd7b5313f71af4bdc5c8c771cb86eb7559afd954cab82ebb5') - version('5.4.1', sha256='5233664eadfa342c639b9b9977190d64ad7aca4edc51a966394d7e08e7f38a9f') - version('5.1.0', sha256='cee9bc75bff455d317b6947081df0824a8f118de2786dc3d74a3503fd631f4ef') - version('3.2.0', sha256='64b0a057210c480aea99406c9391180cd866fc0fd8f0b53367e3af21b195784a') - version('3.0.0', sha256='ad50bef540fe5518a4653c3820452a881b6a042cb0f8bb7657c491c6bd3654bb') - provides('pil') # These defaults correspond to Pillow defaults @@ -73,6 +53,8 @@ class PyPillow(PythonPackage): depends_on('libxcb', when='+xcb') conflicts('+webpmux', when='~webp', msg='Webpmux relies on WebP support') + conflicts('+imagequant', when='@:3.2', msg='imagequant support was added in 3.3') + conflicts('+xcb', when='@:7.0', msg='XCB support was added in 7.1') phases = ['build_ext', 'install'] @@ -93,15 +75,21 @@ class PyPillow(PythonPackage): setup.filter('include_dirs = []', 'include_dirs = {0}'.format(include_dirs), string=True) - def variant_to_cfg(setup): + def variant_to_cfg(variant): able = 'enable' if '+' + variant in self.spec else 'disable' return '{0}-{1}=1\n'.format(able, variant) with open('setup.cfg', 'a') as setup: - # Default backend setup.write('[build_ext]\n') - for variant in self.spec.variants.keys(): - setup.write(variant_to_cfg(setup)) + variants = list(self.spec.variants) + + if self.spec.satisfies('@:7.0'): + variants.remove('xcb') + if self.spec.satisfies('@:3.2'): + variants.remove('imagequant') + + for variant in variants: + setup.write(variant_to_cfg(variant)) setup.write('rpath={0}\n'.format(':'.join(self.rpath))) setup.write('[install]\n') @@ -115,3 +103,30 @@ class PyPillow(PythonPackage): run_after('install')( PythonPackage._run_default_install_time_test_callbacks) run_after('install')(PythonPackage.sanity_check_prefix) + + +class PyPillow(PyPillowBase): + """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.org/" + url = "https://pypi.io/packages/source/P/Pillow/Pillow-7.2.0.tar.gz" + + version('7.2.0', sha256='97f9e7953a77d5a70f49b9a48da7776dc51e9b738151b22dacf101641594a626') + version('7.0.0', sha256='4d9ed9a64095e031435af120d3c910148067087541131e82b3e8db302f4c8946') + version('6.2.2', sha256='db9ff0c251ed066d367f53b64827cc9e18ccea001b986d08c265e53625dab950') + version('6.2.1', sha256='bf4e972a88f8841d8fdc6db1a75e0f8d763e66e3754b03006cbc3854d89f1cb1') + version('6.2.0', sha256='4548236844327a718ce3bb182ab32a16fa2050c61e334e959f554cac052fb0df') + version('6.0.0', sha256='809c0a2ce9032cbcd7b5313f71af4bdc5c8c771cb86eb7559afd954cab82ebb5') + version('5.4.1', sha256='5233664eadfa342c639b9b9977190d64ad7aca4edc51a966394d7e08e7f38a9f') + version('5.1.0', sha256='cee9bc75bff455d317b6947081df0824a8f118de2786dc3d74a3503fd631f4ef') + version('3.2.0', sha256='64b0a057210c480aea99406c9391180cd866fc0fd8f0b53367e3af21b195784a') + version('3.0.0', sha256='ad50bef540fe5518a4653c3820452a881b6a042cb0f8bb7657c491c6bd3654bb') + + for ver in [ + '7.2.0', '7.0.0', '6.2.2', '6.2.1', '6.2.0', '6.0.0', + '5.4.1', '5.1.0', '3.2.0', '3.0.0' + ]: + provides('pil@' + ver, when='@' + ver) diff --git a/var/spack/repos/builtin/packages/py-pycbc/package.py b/var/spack/repos/builtin/packages/py-pycbc/package.py index 69513c2a64..f7e96a3221 100644 --- a/var/spack/repos/builtin/packages/py-pycbc/package.py +++ b/var/spack/repos/builtin/packages/py-pycbc/package.py @@ -26,7 +26,7 @@ class PyPycbc(PythonPackage): depends_on('py-decorator@3.4.2:', type=('build', 'run')) depends_on('py-scipy@0.16.0:', type=('build', 'run')) depends_on('py-matplotlib@1.5.1:', type=('build', 'run')) - depends_on('py-pillow', type=('build', 'run')) + depends_on('pil', type=('build', 'run')) depends_on('py-h5py@2.5:', type=('build', 'run')) depends_on('py-jinja2', type=('build', 'run')) depends_on('py-astropy@2.0.3:', type=('build', 'run')) 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 c43df31787..7d03788d3c 100644 --- a/var/spack/repos/builtin/packages/py-scikit-image/package.py +++ b/var/spack/repos/builtin/packages/py-scikit-image/package.py @@ -19,7 +19,7 @@ class PyScikitImage(PythonPackage): extends('python', ignore=r'bin/.*\.py$') depends_on('py-dask', type=('build', 'run')) - depends_on('py-pillow', type=('build', 'run')) + depends_on('pil', type=('build', 'run')) depends_on('py-networkx', type=('build', 'run')) depends_on('py-six', type=('build', 'run')) depends_on('py-numpy', type=('build', 'run')) diff --git a/var/spack/repos/builtin/packages/py-sphinx-gallery/package.py b/var/spack/repos/builtin/packages/py-sphinx-gallery/package.py index f96e5a11f4..067ea9b40c 100644 --- a/var/spack/repos/builtin/packages/py-sphinx-gallery/package.py +++ b/var/spack/repos/builtin/packages/py-sphinx-gallery/package.py @@ -19,5 +19,5 @@ class PySphinxGallery(PythonPackage): depends_on('py-setuptools') depends_on('py-matplotlib') - depends_on('py-pillow') + depends_on('pil') depends_on('py-sphinx') diff --git a/var/spack/repos/builtin/packages/py-torchvision/package.py b/var/spack/repos/builtin/packages/py-torchvision/package.py index b70e2cd367..9cedfa25a0 100644 --- a/var/spack/repos/builtin/packages/py-torchvision/package.py +++ b/var/spack/repos/builtin/packages/py-torchvision/package.py @@ -60,8 +60,8 @@ class PyTorchvision(PythonPackage): # * libjpeg # https://github.com/pytorch/vision/issues/1712 - depends_on('py-pillow@4.1.1:6', when='@:0.4', type=('build', 'run')) - depends_on('py-pillow@4.1.1:', when='@0.5:', type=('build', 'run')) + depends_on('pil@4.1.1:6', when='@:0.4', type=('build', 'run')) + depends_on('pil@4.1.1:', when='@0.5:', type=('build', 'run')) # Many of the datasets require additional dependencies to use. # These can be installed after the fact. diff --git a/var/spack/repos/builtin/packages/py-wxpython/package.py b/var/spack/repos/builtin/packages/py-wxpython/package.py index 7bbe5a8a8c..0eef3935f0 100644 --- a/var/spack/repos/builtin/packages/py-wxpython/package.py +++ b/var/spack/repos/builtin/packages/py-wxpython/package.py @@ -34,5 +34,5 @@ class PyWxpython(PythonPackage): # Needed at runtime depends_on('py-numpy', type='run') - depends_on('py-pillow', type='run') + depends_on('pil', type='run') depends_on('py-six', type='run') diff --git a/var/spack/repos/builtin/packages/timemory/package.py b/var/spack/repos/builtin/packages/timemory/package.py index 5f1758890d..96de85cfe9 100644 --- a/var/spack/repos/builtin/packages/timemory/package.py +++ b/var/spack/repos/builtin/packages/timemory/package.py @@ -93,7 +93,7 @@ class Timemory(CMakePackage): extends('python', when='+python') depends_on('python@3:', when='+python', type=('build', 'run')) depends_on('py-numpy', when='+python', type=('run')) - depends_on('py-pillow', when='+python', type=('run')) + depends_on('pil', when='+python', type=('run')) depends_on('py-matplotlib', when='+python', type=('run')) depends_on('py-mpi4py', when='+python+mpi', type=('run')) depends_on('py-cython', when='+python', type=('build')) |