-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Bump Pillow version to 8.4.0 #2516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
323 changes: 192 additions & 131 deletions
323
pythonforandroid/recipes/Pillow/patches/fix-setup.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,135 +1,196 @@ | ||
--- Pillow-7.0.0/setup.py.orig 2020-01-02 06:19:26.000000000 +0100 | ||
+++ Pillow-7.0.0/setup.py 2020-07-05 12:26:18.882948858 +0200 | ||
@@ -29,13 +29,13 @@ def get_version(): | ||
|
||
NAME = "Pillow" | ||
PILLOW_VERSION = get_version() | ||
-FREETYPE_ROOT = None | ||
+FREETYPE_ROOT = tuple(os.environ['FREETYPE_ROOT'].split('|')) if 'FREETYPE_ROOT' in os.environ else None | ||
IMAGEQUANT_ROOT = None | ||
JPEG2K_ROOT = None | ||
-JPEG_ROOT = None | ||
+JPEG_ROOT = tuple(os.environ['JPEG_ROOT'].split('|')) if 'JPEG_ROOT' in os.environ else None | ||
LCMS_ROOT = None | ||
TIFF_ROOT = None | ||
-ZLIB_ROOT = None | ||
+ZLIB_ROOT = tuple(os.environ['ZLIB_ROOT'].split('|')) if 'ZLIB_ROOT' in os.environ else None | ||
|
||
|
||
if sys.platform == "win32" and sys.version_info >= (3, 9): | ||
@@ -317,7 +317,7 @@ class pil_build_ext(build_ext): | ||
) | ||
|
||
def initialize_options(self): | ||
- self.disable_platform_guessing = None | ||
+ self.disable_platform_guessing = True | ||
self.add_imaging_libs = "" | ||
build_ext.initialize_options(self) | ||
for x in self.feature: | ||
@@ -567,62 +567,6 @@ class pil_build_ext(build_ext): | ||
feature.jpeg = "libjpeg" # alternative name | ||
|
||
feature.openjpeg_version = None | ||
- if feature.want("jpeg2000"): | ||
- _dbg("Looking for jpeg2000") | ||
- best_version = None | ||
- best_path = None | ||
--- Pillow.orig/setup.py 2021-11-01 14:50:48.000000000 +0100 | ||
+++ Pillow/setup.py 2021-11-01 14:51:31.000000000 +0100 | ||
@@ -125,7 +125,7 @@ | ||
"codec_fd", | ||
) | ||
|
||
-DEBUG = False | ||
+DEBUG = True # So we can easely triage user issues. | ||
|
||
|
||
class DependencyException(Exception): | ||
@@ -411,46 +411,6 @@ | ||
include_dirs = [] | ||
|
||
pkg_config = None | ||
- if _cmd_exists(os.environ.get("PKG_CONFIG", "pkg-config")): | ||
- pkg_config = _pkg_config | ||
- | ||
- # | ||
- # add configured kits | ||
- for root_name, lib_name in dict( | ||
- JPEG_ROOT="libjpeg", | ||
- JPEG2K_ROOT="libopenjp2", | ||
- TIFF_ROOT=("libtiff-5", "libtiff-4"), | ||
- ZLIB_ROOT="zlib", | ||
- FREETYPE_ROOT="freetype2", | ||
- HARFBUZZ_ROOT="harfbuzz", | ||
- FRIBIDI_ROOT="fribidi", | ||
- LCMS_ROOT="lcms2", | ||
- IMAGEQUANT_ROOT="libimagequant", | ||
- ).items(): | ||
- root = globals()[root_name] | ||
- | ||
- if root is None and root_name in os.environ: | ||
- prefix = os.environ[root_name] | ||
- root = (os.path.join(prefix, "lib"), os.path.join(prefix, "include")) | ||
- | ||
- if root is None and pkg_config: | ||
- if isinstance(lib_name, tuple): | ||
- for lib_name2 in lib_name: | ||
- _dbg(f"Looking for `{lib_name2}` using pkg-config.") | ||
- root = pkg_config(lib_name2) | ||
- if root: | ||
- break | ||
- else: | ||
- _dbg(f"Looking for `{lib_name}` using pkg-config.") | ||
- root = pkg_config(lib_name) | ||
- | ||
- if isinstance(root, tuple): | ||
- lib_root, include_root = root | ||
- else: | ||
- lib_root = include_root = root | ||
- | ||
- _add_directory(library_dirs, lib_root) | ||
- _add_directory(include_dirs, include_root) | ||
|
||
# respect CFLAGS/CPPFLAGS/LDFLAGS | ||
for k in ("CFLAGS", "CPPFLAGS", "LDFLAGS"): | ||
@@ -471,137 +431,6 @@ | ||
for d in os.environ[k].split(os.path.pathsep): | ||
_add_directory(library_dirs, d) | ||
|
||
- _add_directory(library_dirs, os.path.join(sys.prefix, "lib")) | ||
- _add_directory(include_dirs, os.path.join(sys.prefix, "include")) | ||
- | ||
- # | ||
- # add platform directories | ||
- | ||
- if self.disable_platform_guessing: | ||
- pass | ||
- | ||
- elif sys.platform == "cygwin": | ||
- # pythonX.Y.dll.a is in the /usr/lib/pythonX.Y/config directory | ||
- _add_directory( | ||
- library_dirs, | ||
- os.path.join( | ||
- "/usr/lib", "python{}.{}".format(*sys.version_info), "config" | ||
- ), | ||
- ) | ||
- | ||
- elif sys.platform == "darwin": | ||
- # attempt to make sure we pick freetype2 over other versions | ||
- _add_directory(include_dirs, "/sw/include/freetype2") | ||
- _add_directory(include_dirs, "/sw/lib/freetype2/include") | ||
- # fink installation directories | ||
- _add_directory(library_dirs, "/sw/lib") | ||
- _add_directory(include_dirs, "/sw/include") | ||
- # darwin ports installation directories | ||
- _add_directory(library_dirs, "/opt/local/lib") | ||
- _add_directory(include_dirs, "/opt/local/include") | ||
- | ||
- # if Homebrew is installed, use its lib and include directories | ||
- try: | ||
- prefix = ( | ||
- subprocess.check_output(["brew", "--prefix"]) | ||
- .strip() | ||
- .decode("latin1") | ||
- ) | ||
- except Exception: | ||
- # Homebrew not installed | ||
- prefix = None | ||
- | ||
- # Find the best version | ||
- for directory in self.compiler.include_dirs: | ||
- _dbg("Checking for openjpeg-#.# in %s", directory) | ||
- ft_prefix = None | ||
- | ||
- if prefix: | ||
- # add Homebrew's include and lib directories | ||
- _add_directory(library_dirs, os.path.join(prefix, "lib")) | ||
- _add_directory(include_dirs, os.path.join(prefix, "include")) | ||
- _add_directory( | ||
- include_dirs, os.path.join(prefix, "opt", "zlib", "include") | ||
- ) | ||
- ft_prefix = os.path.join(prefix, "opt", "freetype") | ||
- | ||
- if ft_prefix and os.path.isdir(ft_prefix): | ||
- # freetype might not be linked into Homebrew's prefix | ||
- _add_directory(library_dirs, os.path.join(ft_prefix, "lib")) | ||
- _add_directory(include_dirs, os.path.join(ft_prefix, "include")) | ||
- else: | ||
- # fall back to freetype from XQuartz if | ||
- # Homebrew's freetype is missing | ||
- _add_directory(library_dirs, "/usr/X11/lib") | ||
- _add_directory(include_dirs, "/usr/X11/include") | ||
- | ||
- # SDK install path | ||
- sdk_path = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" | ||
- if not os.path.exists(sdk_path): | ||
- try: | ||
- listdir = os.listdir(directory) | ||
- sdk_path = ( | ||
- subprocess.check_output(["xcrun", "--show-sdk-path"]) | ||
- .strip() | ||
- .decode("latin1") | ||
- ) | ||
- except Exception: | ||
- # WindowsError, FileNotFoundError | ||
- continue | ||
- for name in listdir: | ||
- if name.startswith("openjpeg-") and os.path.isfile( | ||
- os.path.join(directory, name, "openjpeg.h") | ||
- ): | ||
- _dbg("Found openjpeg.h in %s/%s", (directory, name)) | ||
- version = tuple(int(x) for x in name[9:].split(".")) | ||
- if best_version is None or version > best_version: | ||
- best_version = version | ||
- best_path = os.path.join(directory, name) | ||
- _dbg( | ||
- "Best openjpeg version %s so far in %s", | ||
- (best_version, best_path), | ||
- ) | ||
- | ||
- if best_version and _find_library_file(self, "openjp2"): | ||
- # Add the directory to the include path so we can include | ||
- # <openjpeg.h> rather than having to cope with the versioned | ||
- # include path | ||
- # FIXME (melvyn-sopacua): | ||
- # At this point it's possible that best_path is already in | ||
- # self.compiler.include_dirs. Should investigate how that is | ||
- # possible. | ||
- _add_directory(self.compiler.include_dirs, best_path, 0) | ||
- feature.jpeg2000 = "openjp2" | ||
- feature.openjpeg_version = ".".join(str(x) for x in best_version) | ||
- | ||
- if feature.want("imagequant"): | ||
- _dbg("Looking for imagequant") | ||
- if _find_include_file(self, "libimagequant.h"): | ||
- if _find_library_file(self, "imagequant"): | ||
- feature.imagequant = "imagequant" | ||
- elif _find_library_file(self, "libimagequant"): | ||
- feature.imagequant = "libimagequant" | ||
- | ||
- if feature.want("tiff"): | ||
- _dbg("Looking for tiff") | ||
- if _find_include_file(self, "tiff.h"): | ||
- if _find_library_file(self, "tiff"): | ||
- feature.tiff = "tiff" | ||
- if sys.platform in ["win32", "darwin"] and _find_library_file( | ||
- self, "libtiff" | ||
- ): | ||
- feature.tiff = "libtiff" | ||
|
||
if feature.want("freetype"): | ||
_dbg("Looking for freetype") | ||
@@ -647,15 +591,6 @@ class pil_build_ext(build_ext): | ||
if subdir: | ||
_add_directory(self.compiler.include_dirs, subdir, 0) | ||
|
||
- if feature.want("lcms"): | ||
- _dbg("Looking for lcms") | ||
- if _find_include_file(self, "lcms2.h"): | ||
- if _find_library_file(self, "lcms2"): | ||
- feature.lcms = "lcms2" | ||
- elif _find_library_file(self, "lcms2_static"): | ||
- # alternate Windows name. | ||
- feature.lcms = "lcms2_static" | ||
- | ||
if feature.want("webp"): | ||
_dbg("Looking for webp") | ||
if _find_include_file(self, "webp/encode.h") and _find_include_file( | ||
@@ -717,8 +652,8 @@ class pil_build_ext(build_ext): | ||
defs.append(("HAVE_LIBTIFF", None)) | ||
if sys.platform == "win32": | ||
libs.extend(["kernel32", "user32", "gdi32"]) | ||
- if struct.unpack("h", b"\0\1")[0] == 1: | ||
- defs.append(("WORDS_BIGENDIAN", None)) | ||
+ # if struct.unpack("h", b"\0\1")[0] == 1: | ||
+ # defs.append(("WORDS_BIGENDIAN", None)) | ||
|
||
if sys.platform == "win32" and not (PLATFORM_PYPY or PLATFORM_MINGW): | ||
defs.append(("PILLOW_VERSION", '"\\"%s\\""' % PILLOW_VERSION)) | ||
@@ -769,16 +704,6 @@ class pil_build_ext(build_ext): | ||
) | ||
) | ||
|
||
- tk_libs = ["psapi"] if sys.platform == "win32" else [] | ||
- exts.append( | ||
- Extension( | ||
- "PIL._imagingtk", | ||
- ["src/_imagingtk.c", "src/Tk/tkImaging.c"], | ||
- include_dirs=["src/Tk"], | ||
- libraries=tk_libs, | ||
- ) | ||
- ) | ||
- sdk_path = None | ||
- if sdk_path: | ||
- _add_directory(library_dirs, os.path.join(sdk_path, "usr", "lib")) | ||
- _add_directory(include_dirs, os.path.join(sdk_path, "usr", "include")) | ||
- elif ( | ||
- sys.platform.startswith("linux") | ||
- or sys.platform.startswith("gnu") | ||
- or sys.platform.startswith("freebsd") | ||
- ): | ||
- for dirname in _find_library_dirs_ldconfig(): | ||
- _add_directory(library_dirs, dirname) | ||
- if sys.platform.startswith("linux") and os.environ.get( | ||
- "ANDROID_ROOT", None | ||
- ): | ||
- # termux support for android. | ||
- # system libraries (zlib) are installed in /system/lib | ||
- # headers are at $PREFIX/include | ||
- # user libs are at $PREFIX/lib | ||
- _add_directory( | ||
- library_dirs, os.path.join(os.environ["ANDROID_ROOT"], "lib") | ||
- ) | ||
- | ||
- elif sys.platform.startswith("netbsd"): | ||
- _add_directory(library_dirs, "/usr/pkg/lib") | ||
- _add_directory(include_dirs, "/usr/pkg/include") | ||
- | ||
- elif sys.platform.startswith("sunos5"): | ||
- _add_directory(library_dirs, "/opt/local/lib") | ||
- _add_directory(include_dirs, "/opt/local/include") | ||
- | ||
- # FIXME: check /opt/stuff directories here? | ||
- | ||
- # standard locations | ||
- if not self.disable_platform_guessing: | ||
- _add_directory(library_dirs, "/usr/local/lib") | ||
- _add_directory(include_dirs, "/usr/local/include") | ||
- | ||
- _add_directory(library_dirs, "/usr/lib") | ||
- _add_directory(include_dirs, "/usr/include") | ||
- # alpine, at least | ||
- _add_directory(library_dirs, "/lib") | ||
- | ||
- if sys.platform == "win32": | ||
- # on Windows, look for the OpenJPEG libraries in the location that | ||
- # the official installer puts them | ||
- program_files = os.environ.get("ProgramFiles", "") | ||
- best_version = (0, 0) | ||
- best_path = None | ||
- for name in os.listdir(program_files): | ||
- if name.startswith("OpenJPEG "): | ||
- version = tuple(int(x) for x in name[9:].strip().split(".")) | ||
- if version > best_version: | ||
- best_version = version | ||
- best_path = os.path.join(program_files, name) | ||
- | ||
- if best_path: | ||
- _dbg("Adding %s to search list", best_path) | ||
- _add_directory(library_dirs, os.path.join(best_path, "lib")) | ||
- _add_directory(include_dirs, os.path.join(best_path, "include")) | ||
- | ||
exts.append(Extension("PIL._imagingmath", ["src/_imagingmath.c"])) | ||
exts.append(Extension("PIL._imagingmorph", ["src/_imagingmorph.c"])) | ||
|
||
# | ||
# insert new dirs *before* default libs, to avoid conflicts | ||
# between Python PYD stub libs and real libraries |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always fun to read the diff of a patch 😄