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

kivy / python-for-android / 3770697291

pending completion
3770697291

push

github

GitHub
Merge pull request #2718 from kivy/release-2022.12.20

877 of 2011 branches covered (43.61%)

Branch coverage included in aggregate %.

38 of 86 new or added lines in 16 files covered. (44.19%)

10 existing lines in 4 files now uncovered.

4515 of 6886 relevant lines covered (65.57%)

2.59 hits per line

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

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

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

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

59
    def get_recipe_env(self, arch):
4✔
60
        env = super().get_recipe_env(arch)
×
61
        env['USE_SDL2'] = '1'
×
62
        env["PYGAME_CROSS_COMPILE"] = "TRUE"
×
63
        env["PYGAME_ANDROID"] = "TRUE"
×
64
        return env
×
65

66

67
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