mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 13:14:27 +03:00
Merge pull request #1439 from wiredfool/require-zlib
Require zlib and libjpeg
This commit is contained in:
commit
9a94cbcd27
|
@ -51,10 +51,16 @@ Many of Pillow's features require external libraries:
|
|||
|
||||
* **libjpeg** provides JPEG functionality.
|
||||
|
||||
* Pillow has been tested with libjpeg versions **6b**, **8**, and **9** and libjpeg-turbo version **8**.
|
||||
* Pillow has been tested with libjpeg versions **6b**, **8**, and
|
||||
**9** and libjpeg-turbo version **8**.
|
||||
* Starting with Pillow 3.0.0, libjpeg is required by default, but
|
||||
may be disabled with the `--disable-jpeg` flag.
|
||||
|
||||
* **zlib** provides access to compressed PNGs
|
||||
|
||||
* Starting with Pillow 3.0.0, zlib is required by default, but may
|
||||
be disabled with the `--disable-zlib` flag.
|
||||
|
||||
* **libtiff** provides compressed TIFF functionality
|
||||
|
||||
* Pillow has been tested with libtiff versions **3.x** and **4.0**
|
||||
|
|
9
setup.py
9
setup.py
|
@ -105,7 +105,7 @@ class pil_build_ext(build_ext):
|
|||
class feature:
|
||||
zlib = jpeg = tiff = freetype = tcl = tk = lcms = webp = webpmux = None
|
||||
jpeg2000 = None
|
||||
required = []
|
||||
required = set(['jpeg', 'zlib'])
|
||||
|
||||
def require(self, feat):
|
||||
return feat in self.required
|
||||
|
@ -139,12 +139,13 @@ class pil_build_ext(build_ext):
|
|||
for x in self.feature:
|
||||
if getattr(self, 'disable_%s' % x):
|
||||
setattr(self.feature, x, False)
|
||||
self.feature.required.discard(x)
|
||||
if getattr(self, 'enable_%s' % x):
|
||||
raise ValueError(
|
||||
'Conflicting options: --enable-%s and --disable-%s'
|
||||
% (x, x))
|
||||
if getattr(self, 'enable_%s' % x):
|
||||
self.feature.required.append(x)
|
||||
self.feature.required.add(x)
|
||||
|
||||
def build_extensions(self):
|
||||
|
||||
|
@ -505,6 +506,10 @@ class pil_build_ext(build_ext):
|
|||
|
||||
for f in feature:
|
||||
if not getattr(feature, f) and feature.require(f):
|
||||
if feature in ('jpeg', 'libz'):
|
||||
raise ValueError('%s is required unless explicitly disabled'
|
||||
+ ' using --disable-%s, aborting' %
|
||||
(f, f))
|
||||
raise ValueError(
|
||||
'--enable-%s requested but %s not found, aborting.'
|
||||
% (f, f))
|
||||
|
|
Loading…
Reference in New Issue
Block a user