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

kivy / python-for-android / 23105491571

15 Mar 2026 07:02AM UTC coverage: 63.661% (-0.2%) from 63.887%
23105491571

Pull #3278

github

web-flow
Merge f4008d060 into a4a8b2814
Pull Request #3278: Handling system bars and Edge-to-Edge enforcement (android 15+)

1808 of 3106 branches covered (58.21%)

Branch coverage included in aggregate %.

5280 of 8028 relevant lines covered (65.77%)

5.25 hits per line

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

38.1
/pythonforandroid/recipes/kivy/__init__.py
1
from os.path import join
8✔
2
import sys
8✔
3
import packaging.version
8✔
4

5
import sh
8✔
6
from pythonforandroid.recipe import PyProjectRecipe
8✔
7
from pythonforandroid.toolchain import current_directory, shprint
8✔
8

9

10
def get_kivy_version(recipe, arch):
8✔
11
    with current_directory(join(recipe.get_build_dir(arch.arch), "kivy")):
×
12
        return shprint(
×
13
            sh.Command(sys.executable),
14
            "-c",
15
            "import _version; print(_version.__version__)",
16
        )
17

18

19
def is_kivy_affected_by_deadlock_issue(recipe=None, arch=None):
8✔
20
    return packaging.version.parse(
×
21
        str(get_kivy_version(recipe, arch))
22
    ) < packaging.version.Version("2.2.0.dev0")
23

24

25
def is_kivy_less_than_3(recipe=None, arch=None):
8✔
26
    return packaging.version.parse(
×
27
        str(get_kivy_version(recipe, arch))
28
    ) < packaging.version.Version("3.0.0")
29

30

31
class KivyRecipe(PyProjectRecipe):
8✔
32
    version = '2.3.1'
8✔
33
    url = 'https://github.com/kivy/kivy/archive/{version}.zip'
8✔
34
    name = 'kivy'
8✔
35

36
    depends = [('sdl2', 'sdl3'), 'pyjnius', 'setuptools', 'android']
8✔
37
    python_depends = ['certifi', 'chardet', 'idna', 'requests', 'urllib3', 'filetype']
8✔
38
    hostpython_prerequisites = ["cython>=0.29.1,<=3.0.12"]
8✔
39

40
    # sdl-gl-swapwindow-nogil.patch is needed to avoid a deadlock.
41
    # See: https://github.com/kivy/kivy/pull/8025
42
    # WARNING: Remove this patch when a new Kivy version is released.
43
    patches = [
8✔
44
        ("sdl-gl-swapwindow-nogil.patch", is_kivy_affected_by_deadlock_issue),
45
        ("use_cython.patch", is_kivy_less_than_3),
46
        "no-ast-str.patch"
47
    ]
48

49
    @property
8✔
50
    def need_stl_shared(self):
8✔
51
        if "sdl3" in self.ctx.recipe_build_order:
×
52
            return True
×
53
        else:
54
            return False
×
55

56
    def get_recipe_env(self, arch, **kwargs):
8✔
57
        env = super().get_recipe_env(arch, **kwargs)
×
58

59
        # Taken from CythonRecipe
60
        env['LDFLAGS'] = env['LDFLAGS'] + ' -L{} '.format(
×
61
            self.ctx.get_libs_dir(arch.arch) +
62
            ' -L{} '.format(self.ctx.libs_dir) +
63
            ' -L{}'.format(join(self.ctx.bootstrap.build_dir, 'obj', 'local',
64
                                arch.arch)))
65
        env['LDSHARED'] = env['CC'] + ' -shared'
×
66
        env['LIBLINK'] = 'NOTNONE'
×
67

68
        # NDKPLATFORM is our switch for detecting Android platform, so can't be None
69
        env['NDKPLATFORM'] = "NOTNONE"
×
70
        if not is_kivy_less_than_3(self, arch):
×
71
            env['KIVY_CROSS_PLATFORM'] = 'android'
×
72

73
        if 'sdl2' in self.ctx.recipe_build_order:
×
74
            env['USE_SDL2'] = '1'
×
75
            env['KIVY_SPLIT_EXAMPLES'] = '1'
×
76
            sdl2_mixer_recipe = self.get_recipe('sdl2_mixer', self.ctx)
×
77
            sdl2_image_recipe = self.get_recipe('sdl2_image', self.ctx)
×
78
            env['KIVY_SDL2_PATH'] = ':'.join([
×
79
                join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include'),
80
                *sdl2_image_recipe.get_include_dirs(arch),
81
                *sdl2_mixer_recipe.get_include_dirs(arch),
82
                join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'),
83
            ])
84
        if "sdl3" in self.ctx.recipe_build_order:
×
85
            sdl3_mixer_recipe = self.get_recipe("sdl3_mixer", self.ctx)
×
86
            sdl3_image_recipe = self.get_recipe("sdl3_image", self.ctx)
×
87
            sdl3_ttf_recipe = self.get_recipe("sdl3_ttf", self.ctx)
×
88
            sdl3_recipe = self.get_recipe("sdl3", self.ctx)
×
89
            env["USE_SDL3"] = "1"
×
90
            env["KIVY_SPLIT_EXAMPLES"] = "1"
×
91
            env["KIVY_SDL3_PATH"] = ":".join(
×
92
                [
93
                    *sdl3_mixer_recipe.get_include_dirs(arch),
94
                    *sdl3_image_recipe.get_include_dirs(arch),
95
                    *sdl3_ttf_recipe.get_include_dirs(arch),
96
                    *sdl3_recipe.get_include_dirs(arch),
97
                ]
98
            )
99

100
        return env
×
101

102

103
recipe = KivyRecipe()
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