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

kivy / python-for-android / 14427382821

13 Apr 2025 07:31AM UTC coverage: 59.228% (+0.09%) from 59.141%
14427382821

Pull #3139

github

web-flow
Merge ef12c6333 into 58d148bf8
Pull Request #3139: `kivy` and `pyjnius`: switch to `PyProjectRecipe`

1054 of 2375 branches covered (44.38%)

Branch coverage included in aggregate %.

6 of 8 new or added lines in 2 files covered. (75.0%)

4 existing lines in 1 file now uncovered.

4957 of 7774 relevant lines covered (63.76%)

2.54 hits per line

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

38.64
/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 CythonRecipe, 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
    def get_recipe_env(self, arch):
4✔
38
        env = super().get_recipe_env(arch)
×
NEW
39
        env.update(CythonRecipe.get_recipe_env(self, arch))
×
40
        # NDKPLATFORM is our switch for detecting Android platform, so can't be None
41
        env['NDKPLATFORM'] = "NOTNONE"
×
42
        if 'sdl2' in self.ctx.recipe_build_order:
×
43
            env['USE_SDL2'] = '1'
×
44
            env['KIVY_SPLIT_EXAMPLES'] = '1'
×
45
            sdl2_mixer_recipe = self.get_recipe('sdl2_mixer', self.ctx)
×
46
            sdl2_image_recipe = self.get_recipe('sdl2_image', self.ctx)
×
47
            env['KIVY_SDL2_PATH'] = ':'.join([
×
48
                join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include'),
49
                *sdl2_image_recipe.get_include_dirs(arch),
50
                *sdl2_mixer_recipe.get_include_dirs(arch),
51
                join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'),
52
            ])
53
        if "sdl3" in self.ctx.recipe_build_order:
×
54
            sdl3_mixer_recipe = self.get_recipe("sdl3_mixer", self.ctx)
×
55
            sdl3_image_recipe = self.get_recipe("sdl3_image", self.ctx)
×
56
            sdl3_ttf_recipe = self.get_recipe("sdl3_ttf", self.ctx)
×
UNCOV
57
            sdl3_recipe = self.get_recipe("sdl3", self.ctx)
×
UNCOV
58
            env["USE_SDL3"] = "1"
×
UNCOV
59
            env["KIVY_SPLIT_EXAMPLES"] = "1"
×
UNCOV
60
            env["KIVY_SDL3_PATH"] = ":".join(
×
61
                [
62
                    *sdl3_mixer_recipe.get_include_dirs(arch),
63
                    *sdl3_image_recipe.get_include_dirs(arch),
64
                    *sdl3_ttf_recipe.get_include_dirs(arch),
65
                    *sdl3_recipe.get_include_dirs(arch),
66
                ]
67
            )
68

69
        return env
×
70

71

72
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