|
| 1 | +diff --git a/setup.py b/setup.py |
| 2 | +index 761d552..4ddc598 100755 |
| 3 | +--- a/setup.py |
| 4 | ++++ b/setup.py |
| 5 | +@@ -136,12 +136,12 @@ except (ImportError, OSError): |
| 6 | + |
| 7 | + NAME = 'Pillow' |
| 8 | + PILLOW_VERSION = get_version() |
| 9 | +-JPEG_ROOT = None |
| 10 | ++JPEG_ROOT = tuple(os.environ['JPEG_ROOT'].split('|')) if 'JPEG_ROOT' in os.environ else None |
| 11 | + JPEG2K_ROOT = None |
| 12 | +-ZLIB_ROOT = None |
| 13 | ++ZLIB_ROOT = tuple(os.environ['ZLIB_ROOT'].split('|')) if 'ZLIB_ROOT' in os.environ else None |
| 14 | + IMAGEQUANT_ROOT = None |
| 15 | + TIFF_ROOT = None |
| 16 | +-FREETYPE_ROOT = None |
| 17 | ++FREETYPE_ROOT = tuple(os.environ['FREETYPE_ROOT'].split('|')) if 'FREETYPE_ROOT' in os.environ else None |
| 18 | + LCMS_ROOT = None |
| 19 | + |
| 20 | + |
| 21 | +@@ -194,7 +194,7 @@ class pil_build_ext(build_ext): |
| 22 | + ] |
| 23 | + |
| 24 | + def initialize_options(self): |
| 25 | +- self.disable_platform_guessing = None |
| 26 | ++ self.disable_platform_guessing = True |
| 27 | + build_ext.initialize_options(self) |
| 28 | + for x in self.feature: |
| 29 | + setattr(self, 'disable_%s' % x, None) |
| 30 | +@@ -466,61 +466,6 @@ class pil_build_ext(build_ext): |
| 31 | + feature.jpeg = "libjpeg" # alternative name |
| 32 | + |
| 33 | + feature.openjpeg_version = None |
| 34 | +- if feature.want('jpeg2000'): |
| 35 | +- _dbg('Looking for jpeg2000') |
| 36 | +- best_version = None |
| 37 | +- best_path = None |
| 38 | +- |
| 39 | +- # Find the best version |
| 40 | +- for directory in self.compiler.include_dirs: |
| 41 | +- _dbg('Checking for openjpeg-#.# in %s', directory) |
| 42 | +- try: |
| 43 | +- listdir = os.listdir(directory) |
| 44 | +- except Exception: |
| 45 | +- # WindowsError, FileNotFoundError |
| 46 | +- continue |
| 47 | +- for name in listdir: |
| 48 | +- if name.startswith('openjpeg-') and \ |
| 49 | +- os.path.isfile(os.path.join(directory, name, |
| 50 | +- 'openjpeg.h')): |
| 51 | +- _dbg('Found openjpeg.h in %s/%s', (directory, name)) |
| 52 | +- version = tuple(int(x) for x in name[9:].split('.')) |
| 53 | +- if best_version is None or version > best_version: |
| 54 | +- best_version = version |
| 55 | +- best_path = os.path.join(directory, name) |
| 56 | +- _dbg('Best openjpeg version %s so far in %s', |
| 57 | +- (best_version, best_path)) |
| 58 | +- |
| 59 | +- if best_version and _find_library_file(self, 'openjp2'): |
| 60 | +- # Add the directory to the include path so we can include |
| 61 | +- # <openjpeg.h> rather than having to cope with the versioned |
| 62 | +- # include path |
| 63 | +- # FIXME (melvyn-sopacua): |
| 64 | +- # At this point it's possible that best_path is already in |
| 65 | +- # self.compiler.include_dirs. Should investigate how that is |
| 66 | +- # possible. |
| 67 | +- _add_directory(self.compiler.include_dirs, best_path, 0) |
| 68 | +- feature.jpeg2000 = 'openjp2' |
| 69 | +- feature.openjpeg_version = '.'.join(str(x) for x in best_version) |
| 70 | +- |
| 71 | +- if feature.want('imagequant'): |
| 72 | +- _dbg('Looking for imagequant') |
| 73 | +- if _find_include_file(self, 'libimagequant.h'): |
| 74 | +- if _find_library_file(self, "imagequant"): |
| 75 | +- feature.imagequant = "imagequant" |
| 76 | +- elif _find_library_file(self, "libimagequant"): |
| 77 | +- feature.imagequant = "libimagequant" |
| 78 | +- |
| 79 | +- if feature.want('tiff'): |
| 80 | +- _dbg('Looking for tiff') |
| 81 | +- if _find_include_file(self, 'tiff.h'): |
| 82 | +- if _find_library_file(self, "tiff"): |
| 83 | +- feature.tiff = "tiff" |
| 84 | +- if sys.platform == "win32" and _find_library_file(self, "libtiff"): |
| 85 | +- feature.tiff = "libtiff" |
| 86 | +- if (sys.platform == "darwin" and |
| 87 | +- _find_library_file(self, "libtiff")): |
| 88 | +- feature.tiff = "libtiff" |
| 89 | + |
| 90 | + if feature.want('freetype'): |
| 91 | + _dbg('Looking for freetype') |
| 92 | +@@ -546,36 +491,6 @@ class pil_build_ext(build_ext): |
| 93 | + if subdir: |
| 94 | + _add_directory(self.compiler.include_dirs, subdir, 0) |
| 95 | + |
| 96 | +- if feature.want('lcms'): |
| 97 | +- _dbg('Looking for lcms') |
| 98 | +- if _find_include_file(self, "lcms2.h"): |
| 99 | +- if _find_library_file(self, "lcms2"): |
| 100 | +- feature.lcms = "lcms2" |
| 101 | +- elif _find_library_file(self, "lcms2_static"): |
| 102 | +- # alternate Windows name. |
| 103 | +- feature.lcms = "lcms2_static" |
| 104 | +- |
| 105 | +- if feature.want('webp'): |
| 106 | +- _dbg('Looking for webp') |
| 107 | +- if (_find_include_file(self, "webp/encode.h") and |
| 108 | +- _find_include_file(self, "webp/decode.h")): |
| 109 | +- # In Google's precompiled zip it is call "libwebp": |
| 110 | +- if _find_library_file(self, "webp"): |
| 111 | +- feature.webp = "webp" |
| 112 | +- elif _find_library_file(self, "libwebp"): |
| 113 | +- feature.webp = "libwebp" |
| 114 | +- |
| 115 | +- if feature.want('webpmux'): |
| 116 | +- _dbg('Looking for webpmux') |
| 117 | +- if (_find_include_file(self, "webp/mux.h") and |
| 118 | +- _find_include_file(self, "webp/demux.h")): |
| 119 | +- if (_find_library_file(self, "webpmux") and |
| 120 | +- _find_library_file(self, "webpdemux")): |
| 121 | +- feature.webpmux = "webpmux" |
| 122 | +- if (_find_library_file(self, "libwebpmux") and |
| 123 | +- _find_library_file(self, "libwebpdemux")): |
| 124 | +- feature.webpmux = "libwebpmux" |
| 125 | +- |
| 126 | + for f in feature: |
| 127 | + if not getattr(feature, f) and feature.require(f): |
| 128 | + if f in ('jpeg', 'zlib'): |
| 129 | +@@ -612,8 +527,6 @@ class pil_build_ext(build_ext): |
| 130 | + defs.append(("HAVE_LIBTIFF", None)) |
| 131 | + if sys.platform == "win32": |
| 132 | + libs.extend(["kernel32", "user32", "gdi32"]) |
| 133 | +- if struct.unpack("h", "\0\1".encode('ascii'))[0] == 1: |
| 134 | +- defs.append(("WORDS_BIGENDIAN", None)) |
| 135 | + |
| 136 | + if sys.platform == "win32" and not (PLATFORM_PYPY or PLATFORM_MINGW): |
| 137 | + defs.append(("PILLOW_VERSION", '"\\"%s\\""' % PILLOW_VERSION)) |
| 138 | +@@ -658,10 +571,6 @@ class pil_build_ext(build_ext): |
| 139 | + define_macros=defs)) |
| 140 | + |
| 141 | + tk_libs = ['psapi'] if sys.platform == 'win32' else [] |
| 142 | +- exts.append(Extension("PIL._imagingtk", |
| 143 | +- ["src/_imagingtk.c", "src/Tk/tkImaging.c"], |
| 144 | +- include_dirs=['src/Tk'], |
| 145 | +- libraries=tk_libs)) |
| 146 | + |
| 147 | + exts.append(Extension("PIL._imagingmath", ["src/_imagingmath.c"])) |
| 148 | + exts.append(Extension("PIL._imagingmorph", ["src/_imagingmorph.c"])) |
0 commit comments