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

kivy / python-for-android / 18733541003

23 Oct 2025 12:18AM UTC coverage: 58.823% (+0.03%) from 58.795%
18733541003

Pull #3242

github

web-flow
Merge fbdf8c2e3 into 96112666e
Pull Request #3242: Remove distutils

1075 of 2436 branches covered (44.13%)

Branch coverage included in aggregate %.

5 of 10 new or added lines in 3 files covered. (50.0%)

14 existing lines in 1 file now uncovered.

5042 of 7963 relevant lines covered (63.32%)

5.05 hits per line

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

38.18
/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 is_kivy_affected_by_deadlock_issue(recipe=None, arch=None):
8✔
11
    with current_directory(join(recipe.get_build_dir(arch.arch), "kivy")):
×
12
        kivy_version = shprint(
×
13
            sh.Command(sys.executable),
14
            "-c",
15
            "import _version; print(_version.__version__)",
16
        )
17

18
        return packaging.version.parse(
×
19
            str(kivy_version)
20
        ) < packaging.version.Version("2.2.0.dev0")
21

22

23
class KivyRecipe(PyProjectRecipe):
8✔
24
    version = '2.3.1'
8✔
25
    url = 'https://github.com/kivy/kivy/archive/{version}.zip'
8✔
26
    name = 'kivy'
8✔
27

28
    depends = [('sdl2', 'sdl3'), 'pyjnius', 'setuptools', 'android']
8✔
29
    python_depends = ['certifi', 'chardet', 'idna', 'requests', 'urllib3', 'filetype']
8✔
30
    hostpython_prerequisites = ["cython>=0.29.1,<=3.0.12"]
8✔
31

32
    # sdl-gl-swapwindow-nogil.patch is needed to avoid a deadlock.
33
    # See: https://github.com/kivy/kivy/pull/8025
34
    # WARNING: Remove this patch when a new Kivy version is released.
35
    patches = [
8✔
36
        ("sdl-gl-swapwindow-nogil.patch", is_kivy_affected_by_deadlock_issue),
37
        "use_cython.patch",
38
        "no-ast-str.patch"
39
    ]
40

41
    @property
8✔
42
    def need_stl_shared(self):
8✔
UNCOV
43
        if "sdl3" in self.ctx.recipe_build_order:
×
UNCOV
44
            return True
×
45
        else:
UNCOV
46
            return False
×
47

48
    def get_recipe_env(self, arch, **kwargs):
8✔
UNCOV
49
        env = super().get_recipe_env(arch, **kwargs)
×
50

51
        # Taken from CythonRecipe
UNCOV
52
        env['LDFLAGS'] = env['LDFLAGS'] + ' -L{} '.format(
×
53
            self.ctx.get_libs_dir(arch.arch) +
54
            ' -L{} '.format(self.ctx.libs_dir) +
55
            ' -L{}'.format(join(self.ctx.bootstrap.build_dir, 'obj', 'local',
56
                                arch.arch)))
57
        env['LDSHARED'] = env['CC'] + ' -shared'
×
58
        env['LIBLINK'] = 'NOTNONE'
×
59

60
        # NDKPLATFORM is our switch for detecting Android platform, so can't be None
61
        env['NDKPLATFORM'] = "NOTNONE"
×
62
        if 'sdl2' in self.ctx.recipe_build_order:
×
63
            env['USE_SDL2'] = '1'
×
UNCOV
64
            env['KIVY_SPLIT_EXAMPLES'] = '1'
×
UNCOV
65
            sdl2_mixer_recipe = self.get_recipe('sdl2_mixer', self.ctx)
×
UNCOV
66
            sdl2_image_recipe = self.get_recipe('sdl2_image', self.ctx)
×
UNCOV
67
            env['KIVY_SDL2_PATH'] = ':'.join([
×
68
                join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include'),
69
                *sdl2_image_recipe.get_include_dirs(arch),
70
                *sdl2_mixer_recipe.get_include_dirs(arch),
71
                join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'),
72
            ])
73
        if "sdl3" in self.ctx.recipe_build_order:
×
74
            sdl3_mixer_recipe = self.get_recipe("sdl3_mixer", self.ctx)
×
75
            sdl3_image_recipe = self.get_recipe("sdl3_image", self.ctx)
×
76
            sdl3_ttf_recipe = self.get_recipe("sdl3_ttf", self.ctx)
×
UNCOV
77
            sdl3_recipe = self.get_recipe("sdl3", self.ctx)
×
UNCOV
78
            env["USE_SDL3"] = "1"
×
UNCOV
79
            env["KIVY_SPLIT_EXAMPLES"] = "1"
×
UNCOV
80
            env["KIVY_SDL3_PATH"] = ":".join(
×
81
                [
82
                    *sdl3_mixer_recipe.get_include_dirs(arch),
83
                    *sdl3_image_recipe.get_include_dirs(arch),
84
                    *sdl3_ttf_recipe.get_include_dirs(arch),
85
                    *sdl3_recipe.get_include_dirs(arch),
86
                ]
87
            )
88

UNCOV
89
        return env
×
90

91

92
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