Skip to content

Commit 9c6d8b8

Browse files
authored
[recipes] Update Pillow to v7.0.0 (#2067)
1 parent c0a30ea commit 9c6d8b8

File tree

3 files changed

+81
-83
lines changed

3 files changed

+81
-83
lines changed

pythonforandroid/recipes/Pillow/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44

55
class PillowRecipe(CompiledComponentsPythonRecipe):
66

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

1413
call_hostpython_via_targetpython = False
1514

pythonforandroid/recipes/Pillow/patches/fix-docstring.patch

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 79 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,63 @@
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):
1+
--- Pillow-7.0.0/setup.py.orig 2020-01-02 06:19:26.000000000 +0100
2+
+++ Pillow-7.0.0/setup.py 2020-02-22 17:33:03.121976748 +0100
3+
@@ -29,13 +29,13 @@ def get_version():
64

7-
NAME = 'Pillow'
5+
NAME = "Pillow"
86
PILLOW_VERSION = get_version()
7+
-FREETYPE_ROOT = None
8+
+FREETYPE_ROOT = tuple(os.environ['FREETYPE_ROOT'].split('|')) if 'FREETYPE_ROOT' in os.environ else None
9+
IMAGEQUANT_ROOT = None
10+
JPEG2K_ROOT = None
911
-JPEG_ROOT = None
1012
+JPEG_ROOT = tuple(os.environ['JPEG_ROOT'].split('|')) if 'JPEG_ROOT' in os.environ else None
11-
JPEG2K_ROOT = None
13+
LCMS_ROOT = None
14+
TIFF_ROOT = None
1215
-ZLIB_ROOT = None
1316
+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
1917

2018

21-
@@ -194,7 +194,7 @@ class pil_build_ext(build_ext):
22-
]
19+
if sys.platform == "win32" and sys.version_info >= (3, 9):
20+
@@ -317,7 +317,7 @@ class pil_build_ext(build_ext):
21+
)
2322

2423
def initialize_options(self):
2524
- self.disable_platform_guessing = None
2625
+ self.disable_platform_guessing = True
26+
self.add_imaging_libs = ""
2727
build_ext.initialize_options(self)
2828
for x in self.feature:
29-
setattr(self, 'disable_%s' % x, None)
30-
@@ -466,61 +466,6 @@ class pil_build_ext(build_ext):
29+
@@ -567,62 +567,6 @@ class pil_build_ext(build_ext):
3130
feature.jpeg = "libjpeg" # alternative name
3231

3332
feature.openjpeg_version = None
34-
- if feature.want('jpeg2000'):
35-
- _dbg('Looking for jpeg2000')
33+
- if feature.want("jpeg2000"):
34+
- _dbg("Looking for jpeg2000")
3635
- best_version = None
3736
- best_path = None
3837
-
3938
- # Find the best version
4039
- for directory in self.compiler.include_dirs:
41-
- _dbg('Checking for openjpeg-#.# in %s', directory)
40+
- _dbg("Checking for openjpeg-#.# in %s", directory)
4241
- try:
4342
- listdir = os.listdir(directory)
4443
- except Exception:
4544
- # WindowsError, FileNotFoundError
4645
- continue
4746
- 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('.'))
47+
- if name.startswith("openjpeg-") and os.path.isfile(
48+
- os.path.join(directory, name, "openjpeg.h")
49+
- ):
50+
- _dbg("Found openjpeg.h in %s/%s", (directory, name))
51+
- version = tuple(int(x) for x in name[9:].split("."))
5352
- if best_version is None or version > best_version:
5453
- best_version = version
5554
- best_path = os.path.join(directory, name)
56-
- _dbg('Best openjpeg version %s so far in %s',
57-
- (best_version, best_path))
55+
- _dbg(
56+
- "Best openjpeg version %s so far in %s",
57+
- (best_version, best_path),
58+
- )
5859
-
59-
- if best_version and _find_library_file(self, 'openjp2'):
60+
- if best_version and _find_library_file(self, "openjp2"):
6061
- # Add the directory to the include path so we can include
6162
- # <openjpeg.h> rather than having to cope with the versioned
6263
- # include path
@@ -65,84 +66,95 @@ index 761d552..4ddc598 100755
6566
- # self.compiler.include_dirs. Should investigate how that is
6667
- # possible.
6768
- _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)
69+
- feature.jpeg2000 = "openjp2"
70+
- feature.openjpeg_version = ".".join(str(x) for x in best_version)
7071
-
71-
- if feature.want('imagequant'):
72-
- _dbg('Looking for imagequant')
73-
- if _find_include_file(self, 'libimagequant.h'):
72+
- if feature.want("imagequant"):
73+
- _dbg("Looking for imagequant")
74+
- if _find_include_file(self, "libimagequant.h"):
7475
- if _find_library_file(self, "imagequant"):
7576
- feature.imagequant = "imagequant"
7677
- elif _find_library_file(self, "libimagequant"):
7778
- feature.imagequant = "libimagequant"
7879
-
79-
- if feature.want('tiff'):
80-
- _dbg('Looking for tiff')
81-
- if _find_include_file(self, 'tiff.h'):
80+
- if feature.want("tiff"):
81+
- _dbg("Looking for tiff")
82+
- if _find_include_file(self, "tiff.h"):
8283
- if _find_library_file(self, "tiff"):
8384
- 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")):
85+
- if sys.platform in ["win32", "darwin"] and _find_library_file(
86+
- self, "libtiff"
87+
- ):
8888
- feature.tiff = "libtiff"
8989

90-
if feature.want('freetype'):
91-
_dbg('Looking for freetype')
92-
@@ -546,36 +491,6 @@ class pil_build_ext(build_ext):
90+
if feature.want("freetype"):
91+
_dbg("Looking for freetype")
92+
@@ -647,40 +591,6 @@ class pil_build_ext(build_ext):
9393
if subdir:
9494
_add_directory(self.compiler.include_dirs, subdir, 0)
9595

96-
- if feature.want('lcms'):
97-
- _dbg('Looking for lcms')
96+
- if feature.want("lcms"):
97+
- _dbg("Looking for lcms")
9898
- if _find_include_file(self, "lcms2.h"):
9999
- if _find_library_file(self, "lcms2"):
100100
- feature.lcms = "lcms2"
101101
- elif _find_library_file(self, "lcms2_static"):
102102
- # alternate Windows name.
103103
- feature.lcms = "lcms2_static"
104104
-
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")):
105+
- if feature.want("webp"):
106+
- _dbg("Looking for webp")
107+
- if _find_include_file(self, "webp/encode.h") and _find_include_file(
108+
- self, "webp/decode.h"
109+
- ):
109110
- # In Google's precompiled zip it is call "libwebp":
110111
- if _find_library_file(self, "webp"):
111112
- feature.webp = "webp"
112113
- elif _find_library_file(self, "libwebp"):
113114
- feature.webp = "libwebp"
114115
-
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")):
116+
- if feature.want("webpmux"):
117+
- _dbg("Looking for webpmux")
118+
- if _find_include_file(self, "webp/mux.h") and _find_include_file(
119+
- self, "webp/demux.h"
120+
- ):
121+
- if _find_library_file(self, "webpmux") and _find_library_file(
122+
- self, "webpdemux"
123+
- ):
121124
- feature.webpmux = "webpmux"
122-
- if (_find_library_file(self, "libwebpmux") and
123-
- _find_library_file(self, "libwebpdemux")):
125+
- if _find_library_file(self, "libwebpmux") and _find_library_file(
126+
- self, "libwebpdemux"
127+
- ):
124128
- feature.webpmux = "libwebpmux"
125129
-
126130
for f in feature:
127131
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):
132+
if f in ("jpeg", "zlib"):
133+
@@ -717,8 +627,8 @@ class pil_build_ext(build_ext):
130134
defs.append(("HAVE_LIBTIFF", None))
131135
if sys.platform == "win32":
132136
libs.extend(["kernel32", "user32", "gdi32"])
133-
- if struct.unpack("h", "\0\1".encode('ascii'))[0] == 1:
137+
- if struct.unpack("h", b"\0\1")[0] == 1:
134138
- defs.append(("WORDS_BIGENDIAN", None))
139+
+ # if struct.unpack("h", b"\0\1")[0] == 1:
140+
+ # defs.append(("WORDS_BIGENDIAN", None))
135141

136142
if sys.platform == "win32" and not (PLATFORM_PYPY or PLATFORM_MINGW):
137143
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))
144+
@@ -769,16 +679,6 @@ class pil_build_ext(build_ext):
145+
)
146+
)
146147

148+
- tk_libs = ["psapi"] if sys.platform == "win32" else []
149+
- exts.append(
150+
- Extension(
151+
- "PIL._imagingtk",
152+
- ["src/_imagingtk.c", "src/Tk/tkImaging.c"],
153+
- include_dirs=["src/Tk"],
154+
- libraries=tk_libs,
155+
- )
156+
- )
157+
-
147158
exts.append(Extension("PIL._imagingmath", ["src/_imagingmath.c"]))
148159
exts.append(Extension("PIL._imagingmorph", ["src/_imagingmorph.c"]))
160+

0 commit comments

Comments
 (0)