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

kivy / python-for-android / 14430251794

13 Apr 2025 02:11PM UTC coverage: 59.204% (+0.06%) from 59.141%
14430251794

Pull #3139

github

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

1054 of 2375 branches covered (44.38%)

Branch coverage included in aggregate %.

8 of 16 new or added lines in 2 files covered. (50.0%)

1 existing line in 1 file now uncovered.

4957 of 7778 relevant lines covered (63.73%)

2.54 hits per line

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

36.96
/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
    def get_recipe_env(self, arch, **kwargs):
4✔
NEW
38
        env = super().get_recipe_env(arch, **kwargs)
×
39

40
        # Taken from CythonRecipe
NEW
41
        env['LDFLAGS'] = env['LDFLAGS'] + ' -L{} '.format(
×
42
            self.ctx.get_libs_dir(arch.arch) +
43
            ' -L{} '.format(self.ctx.libs_dir) +
44
            ' -L{}'.format(join(self.ctx.bootstrap.build_dir, 'obj', 'local',
45
                                arch.arch)))
NEW
46
        env['LDSHARED'] = env['CC'] + ' -shared'
×
NEW
47
        env['LIBLINK'] = 'NOTNONE'
×
48

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

78
        return env
×
79

80

81
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