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

kivy / python-for-android / 17641397155

11 Sep 2025 10:15AM UTC coverage: 59.214% (+0.04%) from 59.171%
17641397155

Pull #3168

github

web-flow
Merge 42336ff0c into 5330267b5
Pull Request #3168: Fix broadcast receiver

1060 of 2385 branches covered (44.44%)

Branch coverage included in aggregate %.

4965 of 7790 relevant lines covered (63.74%)

2.54 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
4✔
2
import sys
4✔
3
import packaging.version
4✔
4

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

9

10
def is_kivy_affected_by_deadlock_issue(recipe=None, arch=None):
4✔
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):
4✔
24
    version = '2.3.1'
4✔
25
    url = 'https://github.com/kivy/kivy/archive/{version}.zip'
4✔
26
    name = 'kivy'
4✔
27

28
    depends = [('sdl2', 'sdl3'), 'pyjnius', 'setuptools']
4✔
29
    python_depends = ['certifi', 'chardet', 'idna', 'requests', 'urllib3', 'filetype']
4✔
30
    hostpython_prerequisites = []
4✔
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 = [("sdl-gl-swapwindow-nogil.patch", is_kivy_affected_by_deadlock_issue), "use_cython.patch"]
4✔
36

37
    @property
4✔
38
    def need_stl_shared(self):
4✔
39
        if "sdl3" in self.ctx.recipe_build_order:
×
40
            return True
×
41
        else:
42
            return False
×
43

44
    def get_recipe_env(self, arch, **kwargs):
4✔
45
        env = super().get_recipe_env(arch, **kwargs)
×
46

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

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

85
        return env
×
86

87

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