Skip to content

[recipes] Update Pillow to v7.0.0 #2067

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 1 commit into from
Feb 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pythonforandroid/recipes/Pillow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

class PillowRecipe(CompiledComponentsPythonRecipe):

version = '5.2.0'
version = '7.0.0'
url = 'https://github.com/python-pillow/Pillow/archive/{version}.tar.gz'
site_packages_name = 'Pillow'
depends = ['png', 'jpeg', 'freetype', 'setuptools']
patches = [join('patches', 'fix-docstring.patch'),
join('patches', 'fix-setup.patch')]
patches = [join('patches', 'fix-setup.patch')]

call_hostpython_via_targetpython = False

Expand Down
13 changes: 0 additions & 13 deletions pythonforandroid/recipes/Pillow/patches/fix-docstring.patch

This file was deleted.

146 changes: 79 additions & 67 deletions pythonforandroid/recipes/Pillow/patches/fix-setup.patch
Original file line number Diff line number Diff line change
@@ -1,62 +1,63 @@
diff --git a/setup.py b/setup.py
index 761d552..4ddc598 100755
--- a/setup.py
+++ b/setup.py
@@ -136,12 +136,12 @@ except (ImportError, OSError):
--- Pillow-7.0.0/setup.py.orig 2020-01-02 06:19:26.000000000 +0100
+++ Pillow-7.0.0/setup.py 2020-02-22 17:33:03.121976748 +0100
@@ -29,13 +29,13 @@ def get_version():

NAME = 'Pillow'
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
JPEG2K_ROOT = 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
IMAGEQUANT_ROOT = None
TIFF_ROOT = None
-FREETYPE_ROOT = None
+FREETYPE_ROOT = tuple(os.environ['FREETYPE_ROOT'].split('|')) if 'FREETYPE_ROOT' in os.environ else None
LCMS_ROOT = None


@@ -194,7 +194,7 @@ class pil_build_ext(build_ext):
]
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:
setattr(self, 'disable_%s' % x, None)
@@ -466,61 +466,6 @@ class pil_build_ext(build_ext):
@@ -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')
- if feature.want("jpeg2000"):
- _dbg("Looking for jpeg2000")
- best_version = None
- best_path = None
-
- # Find the best version
- for directory in self.compiler.include_dirs:
- _dbg('Checking for openjpeg-#.# in %s', directory)
- _dbg("Checking for openjpeg-#.# in %s", directory)
- try:
- listdir = os.listdir(directory)
- 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 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))
- _dbg(
- "Best openjpeg version %s so far in %s",
- (best_version, best_path),
- )
-
- if best_version and _find_library_file(self, 'openjp2'):
- 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
Expand All @@ -65,84 +66,95 @@ index 761d552..4ddc598 100755
- # 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)
- 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 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 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 == "win32" and _find_library_file(self, "libtiff"):
- feature.tiff = "libtiff"
- if (sys.platform == "darwin" and
- _find_library_file(self, "libtiff")):
- if sys.platform in ["win32", "darwin"] and _find_library_file(
- self, "libtiff"
- ):
- feature.tiff = "libtiff"

if feature.want('freetype'):
_dbg('Looking for freetype')
@@ -546,36 +491,6 @@ class pil_build_ext(build_ext):
if feature.want("freetype"):
_dbg("Looking for freetype")
@@ -647,40 +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 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(self, "webp/decode.h")):
- if feature.want("webp"):
- _dbg("Looking for webp")
- if _find_include_file(self, "webp/encode.h") and _find_include_file(
- self, "webp/decode.h"
- ):
- # In Google's precompiled zip it is call "libwebp":
- if _find_library_file(self, "webp"):
- feature.webp = "webp"
- elif _find_library_file(self, "libwebp"):
- feature.webp = "libwebp"
-
- if feature.want('webpmux'):
- _dbg('Looking for webpmux')
- if (_find_include_file(self, "webp/mux.h") and
- _find_include_file(self, "webp/demux.h")):
- if (_find_library_file(self, "webpmux") and
- _find_library_file(self, "webpdemux")):
- if feature.want("webpmux"):
- _dbg("Looking for webpmux")
- if _find_include_file(self, "webp/mux.h") and _find_include_file(
- self, "webp/demux.h"
- ):
- if _find_library_file(self, "webpmux") and _find_library_file(
- self, "webpdemux"
- ):
- feature.webpmux = "webpmux"
- if (_find_library_file(self, "libwebpmux") and
- _find_library_file(self, "libwebpdemux")):
- if _find_library_file(self, "libwebpmux") and _find_library_file(
- self, "libwebpdemux"
- ):
- feature.webpmux = "libwebpmux"
-
for f in feature:
if not getattr(feature, f) and feature.require(f):
if f in ('jpeg', 'zlib'):
@@ -612,8 +527,6 @@ class pil_build_ext(build_ext):
if f in ("jpeg", "zlib"):
@@ -717,8 +627,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", "\0\1".encode('ascii'))[0] == 1:
- 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))
@@ -658,10 +571,6 @@ class pil_build_ext(build_ext):
define_macros=defs))

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))
@@ -769,16 +679,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,
- )
- )
-
exts.append(Extension("PIL._imagingmath", ["src/_imagingmath.c"]))
exts.append(Extension("PIL._imagingmorph", ["src/_imagingmorph.c"]))