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

kivy / python-for-android / 17517234198

06 Sep 2025 05:07PM UTC coverage: 58.947% (-0.3%) from 59.214%
17517234198

Pull #3202

github

web-flow
Merge 11300622b into 5330267b5
Pull Request #3202: [WIP] Add Skia recipe for Kivy 3.0.0.dev0

1060 of 2403 branches covered (44.11%)

Branch coverage included in aggregate %.

23 of 65 new or added lines in 2 files covered. (35.38%)

4985 of 7852 relevant lines covered (63.49%)

2.53 hits per line

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

36.84
/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

25
    version = '3.0.0.dev0'
4✔
26
    url = 'https://github.com/DexerBR/kivy/archive/refs/heads/skia-graphics-backend.zip'
4✔
27
    name = 'kivy'
4✔
28

29
    depends = [('sdl2', 'sdl3'), 'pyjnius', 'setuptools', 'skia']
4✔
30
    python_depends = ['certifi', 'chardet', 'idna', 'requests', 'urllib3', 'filetype']
4✔
31
    hostpython_prerequisites = []
4✔
32

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

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

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

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

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

88
        return env
×
89

90

91
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

© 2025 Coveralls, Inc