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

kivy / python-for-android / 7239023125

17 Dec 2023 02:11PM UTC coverage: 59.041% (-0.05%) from 59.09%
7239023125

push

github

web-flow
Update sdl2 deps to reflect the same targeted in kivy/kivy (#2927)

* Update sdl2 deps to reflect the same targeted in kivy/kivy

* Update md5 sum

* Create new patch and set new include dir for sdl_image

* Set pygame as broken recipe

* sdl_image 2.8.0 has been released

941 of 2245 branches covered (0.0%)

Branch coverage included in aggregate %.

6 of 12 new or added lines in 6 files covered. (50.0%)

3 existing lines in 3 files now uncovered.

4734 of 7367 relevant lines covered (64.26%)

2.56 hits per line

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

31.11
/pythonforandroid/recipes/pygame/__init__.py
1
from os.path import join
4✔
2

3
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
4✔
4
from pythonforandroid.toolchain import current_directory
4✔
5

6

7
class Pygame2Recipe(CompiledComponentsPythonRecipe):
4✔
8
    """
9
    Recipe to build apps based on SDL2-based pygame.
10

11
    .. warning:: Some pygame functionality is still untested, and some
12
        dependencies like freetype, postmidi and libjpeg are currently
13
        not part of the build. It's usable, but not complete.
14
    """
15

16
    version = '2.1.0'
4✔
17
    url = 'https://github.com/pygame/pygame/archive/{version}.tar.gz'
4✔
18

19
    site_packages_name = 'pygame'
4✔
20
    name = 'pygame'
4✔
21

22
    depends = ['sdl2', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'setuptools', 'jpeg', 'png']
4✔
23
    call_hostpython_via_targetpython = False  # Due to setuptools
4✔
24
    install_in_hostpython = False
4✔
25

26
    def prebuild_arch(self, arch):
4✔
27
        super().prebuild_arch(arch)
×
28
        with current_directory(self.get_build_dir(arch.arch)):
×
29
            setup_template = open(join("buildconfig", "Setup.Android.SDL2.in")).read()
×
30
            env = self.get_recipe_env(arch)
×
31
            env['ANDROID_ROOT'] = join(self.ctx.ndk.sysroot, 'usr')
×
32

33
            png = self.get_recipe('png', self.ctx)
×
34
            png_lib_dir = join(png.get_build_dir(arch.arch), '.libs')
×
35
            png_inc_dir = png.get_build_dir(arch)
×
36

37
            jpeg = self.get_recipe('jpeg', self.ctx)
×
38
            jpeg_inc_dir = jpeg_lib_dir = jpeg.get_build_dir(arch.arch)
×
39

40
            sdl_mixer_includes = ""
×
41
            sdl2_mixer_recipe = self.get_recipe('sdl2_mixer', self.ctx)
×
42
            for include_dir in sdl2_mixer_recipe.get_include_dirs(arch):
×
43
                sdl_mixer_includes += f"-I{include_dir} "
×
44

NEW
45
            sdl2_image_includes = ""
×
NEW
46
            sdl2_image_recipe = self.get_recipe('sdl2_image', self.ctx)
×
NEW
47
            for include_dir in sdl2_image_recipe.get_include_dirs(arch):
×
NEW
48
                sdl2_image_includes += f"-I{include_dir} "
×
49

UNCOV
50
            setup_file = setup_template.format(
×
51
                sdl_includes=(
52
                    " -I" + join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include') +
53
                    " -L" + join(self.ctx.bootstrap.build_dir, "libs", str(arch)) +
54
                    " -L" + png_lib_dir + " -L" + jpeg_lib_dir + " -L" + arch.ndk_lib_dir_versioned),
55
                sdl_ttf_includes="-I"+join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'),
56
                sdl_image_includes=sdl2_image_includes,
57
                sdl_mixer_includes=sdl_mixer_includes,
58
                jpeg_includes="-I"+jpeg_inc_dir,
59
                png_includes="-I"+png_inc_dir,
60
                freetype_includes=""
61
            )
62
            open("Setup", "w").write(setup_file)
×
63

64
    def get_recipe_env(self, arch):
4✔
65
        env = super().get_recipe_env(arch)
×
66
        env['USE_SDL2'] = '1'
×
67
        env["PYGAME_CROSS_COMPILE"] = "TRUE"
×
68
        env["PYGAME_ANDROID"] = "TRUE"
×
69
        return env
×
70

71

72
recipe = Pygame2Recipe()
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