summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew W Elble <aweits@rit.edu>2020-01-30 15:42:48 -0500
committerGitHub <noreply@github.com>2020-01-30 14:42:48 -0600
commitb072caadeced9ed1eda97825d9242849294f7362 (patch)
tree65427d8305027f60434318b42a752fb2ecb9a08f
parent7b2895109cac96174949b51ba19c5fc9aa011ad7 (diff)
downloadspack-b072caadeced9ed1eda97825d9242849294f7362.tar.gz
spack-b072caadeced9ed1eda97825d9242849294f7362.tar.bz2
spack-b072caadeced9ed1eda97825d9242849294f7362.tar.xz
spack-b072caadeced9ed1eda97825d9242849294f7362.zip
fix: py-pillow build_ext vs. install (#14666)
Previously, the install stage would compile in things that were disabled during the build_ext phase. This would also result in the build pulling in locally installed versions of libraries that were disabled. The install process doesn't honor the same command-line flags that build_ext does, but does call build_ext again. Avoid the whole issue by just writing the options to setup.cfg Also, add the Imagemagick dependency for tests.
-rw-r--r--var/spack/repos/builtin/packages/py-pillow/package.py35
1 files changed, 20 insertions, 15 deletions
diff --git a/var/spack/repos/builtin/packages/py-pillow/package.py b/var/spack/repos/builtin/packages/py-pillow/package.py
index 9f537d3138..36d99f2c01 100644
--- a/var/spack/repos/builtin/packages/py-pillow/package.py
+++ b/var/spack/repos/builtin/packages/py-pillow/package.py
@@ -61,6 +61,7 @@ class PyPillow(PythonPackage):
depends_on('libwebp', when='+webp')
depends_on('libwebp+libwebpmux+libwebpdemux', when='+webpmux')
depends_on('openjpeg', when='+jpeg2000')
+ depends_on('imagemagick', type='test')
# Spack does not (yet) support these modes of building
# depends_on('libimagequant', when='+imagequant')
@@ -86,21 +87,25 @@ class PyPillow(PythonPackage):
setup.filter('include_dirs = []',
'include_dirs = {0}'.format(include_dirs), string=True)
- def build_ext_args(self, spec, prefix):
- def variant_to_flag(variant):
- able = 'enable' if '+' + variant in spec else 'disable'
- return '--{0}-{1}'.format(able, variant)
-
- args = ['--enable-zlib', '--enable-jpeg']
-
- variants = ['tiff', 'freetype', 'lcms', 'webp', 'webpmux', 'jpeg2000']
- args.extend(list(map(variant_to_flag, variants)))
-
- # Spack does not (yet) support these modes of building
- args.append('--disable-imagequant')
-
- args.append('--rpath={0}'.format(':'.join(self.rpath)))
- return args
+ def variant_to_cfg(setup):
+ 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')
+ setup.write('enable-zlib=1\n')
+ setup.write('enable-jpeg=1\n')
+ variants = ['tiff', 'freetype', 'lcms', 'webp',
+ 'webpmux', 'jpeg2000']
+ for variant in variants:
+ setup.write(variant_to_cfg(setup))
+
+ # Spack does not (yet) support these modes of building
+ setup.write('disable-imagequant=1\n')
+
+ setup.write('rpath={0}\n'.format(':'.join(self.rpath)))
+ setup.write('[install]\n')
# Tests need to be re-added since `phases` was overridden
run_after('build_ext')(