Commit b967753
committed
python3-modules: build pillow without FreeType
With the sync no longer breaking on it, sles-12sp5 gets as far as
compiling pillow - and fails there:
src/_imagingft.c: error: implicit declaration of function
'FT_Set_Named_Instance'
pillow 12.0.0 removed the FREETYPE_MAJOR/MINOR guards around the variable
font API (python-pillow/Pillow#9159), so _imagingft now calls
FT_Done_MM_Var and FT_Set_Named_Instance unconditionally and needs
FreeType >= 2.9.1. pillow's setup.py only probes whether FreeType is
present, never which version, so it enables the module regardless.
sles-12sp5 ships FreeType 2.6.3 and nothing newer is installable:
freetype2-devel-2.6.3-7.15.1 (the only version in our sles12sp5 repo)
FREETYPE_MAJOR 2 / FREETYPE_MINOR 6 / FREETYPE_PATCH 3
ftmm.h declares neither of the two functions
libfreetype.so.6 exports neither of them
Note the last line: the runtime library is equally old, so building
against a newer FreeType without also shipping it would only move the
failure to the customer's machine - the SONAME stayed libfreetype.so.6
across all these versions, and we link with -z now, so it would fail at
import rather than lazily.
We never render text with PIL - it is used for image IO only, there is no
ImageFont, ImageDraw or truetype anywhere in the repo - so disable the
feature instead of shipping a FreeType. master already disables avif the
same way, because libavif is unavailable on debian-12.
Where the option goes matters: pip applies --config-settings only to
requirements named on the command line, never to the ones it reads from a
"-r" file, and both builds install from "-r". So it has to be attached to
the requirement itself rather than to the pip invocation. For Bazel that
is the generated per-module requirements file. For the .venv it means
installing pillow up front, because the requirements file pipenv hands to
pip is not ours to extend and pipenv has no Pipfile syntax for per-package
pip options. Requirement and hashes come from Pipfile.lock, so pillow
stays pinned and hash checked, and the sync afterwards finds it already
satisfied and leaves it alone. (get_pip_options() keeps its numpy entry,
which is ineffective for the same reason, but changing how numpy builds is
out of scope here.)
Verified by rebuilding the venv from scratch with PIP_NO_BINARY=pillow, so
that pillow is built from source exactly as on sles-12sp5: PIL reports
freetype2 False with no _imagingft*.so, while a normal wheel based rebuild
is unaffected. "make test-mypy" still reports no issues in 7436 source
files.
Change-Id: I02a16f5f1007b0f8befd9f0c1f68a4c8822a0f651 parent 359768b commit b967753
2 files changed
Lines changed: 33 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
442 | 451 | | |
443 | 452 | | |
444 | 453 | | |
| |||
455 | 464 | | |
456 | 465 | | |
457 | 466 | | |
458 | | - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
459 | 474 | | |
460 | 475 | | |
461 | 476 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
12 | 28 | | |
13 | 29 | | |
14 | 30 | | |
| |||
17 | 33 | | |
18 | 34 | | |
19 | 35 | | |
20 | | - | |
| 36 | + | |
21 | 37 | | |
22 | 38 | | |
23 | 39 | | |
| |||
0 commit comments