• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kivy / python-for-android / 19224356603

10 Nov 2025 07:42AM UTC coverage: 64.135% (+2.2%) from 61.929%
19224356603

push

github

web-flow
Merge pull request #3256 from DexerBR/pillow-recipe

Fix `libm` linkage for Pillow recipe builds

1817 of 3084 branches covered (58.92%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

5259 of 7949 relevant lines covered (66.16%)

5.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

36.36
/pythonforandroid/recipes/Pillow/__init__.py
1
from os.path import join
8✔
2

3
from pythonforandroid.recipe import PyProjectRecipe
8✔
4

5

6
class PillowRecipe(PyProjectRecipe):
8✔
7
    """
8
    A recipe for Pillow (previously known as Pil).
9

10
    This recipe allow us to build the Pillow recipe with support for different
11
    types of images and fonts. But you should be aware, that in order to  use
12
    some of the features of  Pillow, we must build some libraries. By default
13
    we automatically trigger the build of below libraries::
14

15
        - freetype: rendering fonts support.
16
        - harfbuzz: a text shaping library.
17
        - jpeg: reading and writing JPEG image files.
18
        - png: support for PNG images.
19

20
    But you also could enable the build of some extra image types by requesting
21
    the build of some libraries via argument `requirements`::
22

23
        - libwebp: library to encode and decode images in WebP format.
24
    """
25

26
    version = '11.3.0'
8✔
27
    url = 'https://github.com/python-pillow/Pillow/archive/{version}.tar.gz'
8✔
28
    site_packages_name = 'PIL'
8✔
29
    patches = ["setup.py.patch"]
8✔
30
    depends = ['png', 'jpeg', 'freetype']
8✔
31
    hostpython_prerequisites = ["setuptools>=77"]
8✔
32
    opt_depends = ['libwebp']
8✔
33

34
    def get_recipe_env(self, arch, **kwargs):
8✔
35
        env = super().get_recipe_env(arch, **kwargs)
×
36

37
        # Add math library linkage
NEW
38
        env["LDFLAGS"] = env.get("LDFLAGS", "") + " -lm"
×
39

40
        jpeg = self.get_recipe('jpeg', self.ctx)
×
41
        jpeg_inc_dir = jpeg_lib_dir = jpeg.get_build_dir(arch.arch)
×
42
        env["JPEG_ROOT"] = "{}:{}".format(jpeg_lib_dir, jpeg_inc_dir)
×
43

44
        freetype = self.get_recipe('freetype', self.ctx)
×
45
        free_lib_dir = join(freetype.get_build_dir(arch.arch), 'objs', '.libs')
×
46
        free_inc_dir = join(freetype.get_build_dir(arch.arch), 'include')
×
47
        env["FREETYPE_ROOT"] = "{}:{}".format(free_lib_dir, free_inc_dir)
×
48

49
        # harfbuzz is a direct dependency of freetype and we need the proper
50
        # flags to successfully build the Pillow recipe, so we add them here.
51
        harfbuzz = self.get_recipe('harfbuzz', self.ctx)
×
52
        harf_lib_dir = join(harfbuzz.get_build_dir(arch.arch), 'src', '.libs')
×
53
        harf_inc_dir = harfbuzz.get_build_dir(arch.arch)
×
54
        env["HARFBUZZ_ROOT"] = "{}:{}".format(harf_lib_dir, harf_inc_dir)
×
55

56
        env["ZLIB_ROOT"] = f"{arch.ndk_lib_dir_versioned}:{self.ctx.ndk.sysroot_include_dir}"
×
57

58
        # libwebp is an optional dependency, so we add the
59
        # flags if we have it in our `ctx.recipe_build_order`
60
        if 'libwebp' in self.ctx.recipe_build_order:
×
61
            webp = self.get_recipe('libwebp', self.ctx)
×
62
            webp_install = join(
×
63
                webp.get_build_dir(arch.arch), 'installation'
64
            )
65
            env["WEBP_ROOT"] = f"{join(webp_install, 'lib')}:{join(webp_install, 'include')}"
×
66
        return env
×
67

68

69
recipe = PillowRecipe()
8✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc