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

kivy / python-for-android / 8498919932

31 Mar 2024 02:35PM UTC coverage: 58.893% (-0.2%) from 59.11%
8498919932

push

github

web-flow
recipes: Introduce `RustCompiledComponentsRecipe`, add `pydantic-core` and update `cryptography` (#2962)

956 of 2283 branches covered (41.87%)

Branch coverage included in aggregate %.

50 of 105 new or added lines in 5 files covered. (47.62%)

1 existing line in 1 file now uncovered.

4819 of 7523 relevant lines covered (64.06%)

2.55 hits per line

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

44.64
/pythonforandroid/recipes/numpy/__init__.py
1
from pythonforandroid.recipe import CompiledComponentsPythonRecipe, Recipe
4✔
2
from pythonforandroid.logger import shprint, info
4✔
3
from pythonforandroid.util import current_directory
4✔
4
from multiprocessing import cpu_count
4✔
5
from os.path import join
4✔
6
import glob
4✔
7
import sh
4✔
8
import shutil
4✔
9

10

11
class NumpyRecipe(CompiledComponentsPythonRecipe):
4✔
12

13
    version = '1.22.3'
4✔
14
    url = 'https://pypi.python.org/packages/source/n/numpy/numpy-{version}.zip'
4✔
15
    site_packages_name = 'numpy'
4✔
16
    depends = ["cython"]
4✔
17

18
    # This build specifically requires setuptools version 59.2.0
19
    hostpython_prerequisites = ["setuptools==59.2.0"]
4✔
20

21
    install_in_hostpython = True
4✔
22
    call_hostpython_via_targetpython = False
4✔
23

24
    patches = [
4✔
25
        join("patches", "remove-default-paths.patch"),
26
        join("patches", "add_libm_explicitly_to_build.patch"),
27
        join("patches", "ranlib.patch"),
28
    ]
29

30
    def get_recipe_env(self, arch=None, with_flags_in_cc=True):
4✔
31
        env = super().get_recipe_env(arch, with_flags_in_cc)
×
32

33
        # _PYTHON_HOST_PLATFORM declares that we're cross-compiling
34
        # and avoids issues when building on macOS for Android targets.
35
        env["_PYTHON_HOST_PLATFORM"] = arch.command_prefix
×
36

37
        # NPY_DISABLE_SVML=1 allows numpy to build for non-AVX512 CPUs
38
        # See: https://github.com/numpy/numpy/issues/21196
39
        env["NPY_DISABLE_SVML"] = "1"
×
40

41
        return env
×
42

43
    def build_arch(self, arch):
4✔
NEW
44
        self.hostpython_prerequisites = ["setuptools==59.2.0"]
×
NEW
45
        self.install_hostpython_prerequisites()
×
46

NEW
47
        super().build_arch(arch)
×
48

49
        # Post build step to restore setuptools version
NEW
50
        self.hostpython_prerequisites = ["setuptools=={}".format(
×
51
            Recipe.get_recipe("setuptools", self.ctx).version)
52
        ]
NEW
53
        self.install_hostpython_prerequisites()
×
54

55
    def _build_compiled_components(self, arch):
4✔
56
        info('Building compiled components in {}'.format(self.name))
×
57

58
        env = self.get_recipe_env(arch)
×
59
        with current_directory(self.get_build_dir(arch.arch)):
×
60
            hostpython = sh.Command(self.hostpython_location)
×
61
            shprint(hostpython, 'setup.py', self.build_cmd, '-v',
×
62
                    _env=env, *self.setup_extra_args)
63
            build_dir = glob.glob('build/lib.*')[0]
×
64
            shprint(sh.find, build_dir, '-name', '"*.o"', '-exec',
×
65
                    env['STRIP'], '{}', ';', _env=env)
66

67
    def _rebuild_compiled_components(self, arch, env):
4✔
68
        info('Rebuilding compiled components in {}'.format(self.name))
×
69

70
        hostpython = sh.Command(self.real_hostpython_location)
×
71
        shprint(hostpython, 'setup.py', 'clean', '--all', '--force', _env=env)
×
72
        shprint(hostpython, 'setup.py', self.build_cmd, '-v', _env=env,
×
73
                *self.setup_extra_args)
74

75
    def build_compiled_components(self, arch):
4✔
76
        self.setup_extra_args = ['-j', str(cpu_count())]
×
77
        self._build_compiled_components(arch)
×
78
        self.setup_extra_args = []
×
79

80
    def rebuild_compiled_components(self, arch, env):
4✔
81
        self.setup_extra_args = ['-j', str(cpu_count())]
×
82
        self._rebuild_compiled_components(arch, env)
×
83
        self.setup_extra_args = []
×
84

85
    def get_hostrecipe_env(self, arch):
4✔
86
        env = super().get_hostrecipe_env(arch)
×
87
        env['RANLIB'] = shutil.which('ranlib')
×
88
        return env
×
89

90

91
recipe = NumpyRecipe()
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