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

kivy / python-for-android / 9236709041

25 May 2024 04:13PM UTC coverage: 59.118% (+0.1%) from 58.992%
9236709041

push

github

web-flow
Merge pull request #3022 from T-Dynamos/pillow-update

pillow: update to `10.3.0`

1044 of 2355 branches covered (44.33%)

Branch coverage included in aggregate %.

5 of 12 new or added lines in 1 file covered. (41.67%)

1 existing line in 1 file now uncovered.

4843 of 7603 relevant lines covered (63.7%)

2.54 hits per line

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

35.48
/pythonforandroid/recipes/Pillow/__init__.py
1
from os.path import join
4✔
2

3
from pythonforandroid.recipe import PyProjectRecipe
4✔
4

5

6
class PillowRecipe(PyProjectRecipe):
4✔
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 = '10.3.0'
4✔
27
    url = 'https://github.com/python-pillow/Pillow/archive/{version}.tar.gz'
4✔
28
    site_packages_name = 'PIL'
4✔
29
    patches = ["setup.py.patch"]
4✔
30
    depends = ['png', 'jpeg', 'freetype', 'setuptools']
4✔
31
    opt_depends = ['libwebp']
4✔
32

33
    def get_recipe_env(self, arch, **kwargs):
4✔
NEW
34
        env = super().get_recipe_env(arch, **kwargs)
×
35

36
        jpeg = self.get_recipe('jpeg', self.ctx)
×
37
        jpeg_inc_dir = jpeg_lib_dir = jpeg.get_build_dir(arch.arch)
×
NEW
38
        env["JPEG_ROOT"] = "{}:{}".format(jpeg_lib_dir, jpeg_inc_dir)
×
39

40
        freetype = self.get_recipe('freetype', self.ctx)
×
41
        free_lib_dir = join(freetype.get_build_dir(arch.arch), 'objs', '.libs')
×
42
        free_inc_dir = join(freetype.get_build_dir(arch.arch), 'include')
×
NEW
43
        env["FREETYPE_ROOT"] = "{}:{}".format(free_lib_dir, free_inc_dir)
×
44

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

NEW
52
        env["ZLIB_ROOT"] = f"{arch.ndk_lib_dir_versioned}:{self.ctx.ndk.sysroot_include_dir}"
×
53

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

64

65
recipe = PillowRecipe()
4✔
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