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

kivy / python-for-android / 5976260269

25 Aug 2023 01:05PM UTC coverage: 58.986% (+0.3%) from 58.676%
5976260269

push

github

web-flow
Standardise `ensure_dir` and `rmdir` (#2871)

* Standardise ensure_dir and rmdir

* Standardise ensure_dir and rmdir

* Add libmysqlclient to broken list

* Libtorrent failing to be rebuilt

* Add boost to broken recipes list

940 of 2241 branches covered (0.0%)

Branch coverage included in aggregate %.

73 of 113 new or added lines in 21 files covered. (64.6%)

3 existing lines in 3 files now uncovered.

4715 of 7346 relevant lines covered (64.18%)

2.56 hits per line

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

32.79
/pythonforandroid/recipes/lapack/__init__.py
1
'''
2
known to build with cmake version 3.23.2 and NDK r21e.
3
See https://gitlab.kitware.com/cmake/cmake/-/issues/18739
4
'''
5

6
from pythonforandroid.recipe import Recipe
4✔
7
from pythonforandroid.logger import shprint
4✔
8
from pythonforandroid.util import current_directory, ensure_dir, BuildInterruptingException
4✔
9
from multiprocessing import cpu_count
4✔
10
from os.path import join
4✔
11
import sh
4✔
12
import shutil
4✔
13
from os import environ
4✔
14
from pythonforandroid.util import build_platform, rmdir
4✔
15

16
arch_to_sysroot = {'armeabi': 'arm', 'armeabi-v7a': 'arm', 'arm64-v8a': 'arm64'}
4✔
17

18

19
def arch_to_toolchain(arch):
4✔
20
    if 'arm' in arch.arch:
×
21
        return arch.command_prefix
×
22
    return arch.arch
×
23

24

25
class LapackRecipe(Recipe):
4✔
26

27
    name = 'lapack'
4✔
28
    version = 'v3.10.1'
4✔
29
    url = 'https://github.com/Reference-LAPACK/lapack/archive/{version}.tar.gz'
4✔
30
    libdir = 'build/install/lib'
4✔
31
    built_libraries = {'libblas.so': libdir, 'liblapack.so': libdir, 'libcblas.so': libdir}
4✔
32

33
    def get_recipe_env(self, arch):
4✔
34
        env = super().get_recipe_env(arch)
×
35

36
        ndk_dir = environ.get("LEGACY_NDK")
×
37
        if ndk_dir is None:
×
38
            raise BuildInterruptingException("Please set the environment variable 'LEGACY_NDK' to point to a NDK location with gcc/gfortran support (supported NDK version: 'r21e')")
×
39

40
        GCC_VER = '4.9'
×
41
        HOST = build_platform
×
42

43
        sysroot_suffix = arch_to_sysroot.get(arch.arch, arch.arch)
×
44
        sysroot = f"{ndk_dir}/platforms/{env['NDK_API']}/arch-{sysroot_suffix}"
×
45
        FC = f"{ndk_dir}/toolchains/{arch_to_toolchain(arch)}-{GCC_VER}/prebuilt/{HOST}/bin/{arch.command_prefix}-gfortran"
×
46
        env['FC'] = f'{FC} --sysroot={sysroot}'
×
47
        if shutil.which(FC) is None:
×
48
            raise BuildInterruptingException(f"{FC} not found. See https://github.com/mzakharo/android-gfortran")
×
49
        return env
×
50

51
    def build_arch(self, arch):
4✔
52
        source_dir = self.get_build_dir(arch.arch)
×
53
        build_target = join(source_dir, 'build')
×
54
        install_target = join(build_target, 'install')
×
55

56
        ensure_dir(build_target)
×
57
        with current_directory(build_target):
×
58
            env = self.get_recipe_env(arch)
×
59
            ndk_dir = environ["LEGACY_NDK"]
×
NEW
60
            rmdir('CMakeFiles')
×
NEW
61
            shprint(sh.rm, '-f', 'CMakeCache.txt', _env=env)
×
UNCOV
62
            opts = [
×
63
                    '-DCMAKE_SYSTEM_NAME=Android',
64
                    '-DCMAKE_POSITION_INDEPENDENT_CODE=1',
65
                    '-DCMAKE_ANDROID_ARCH_ABI={arch}'.format(arch=arch.arch),
66
                    '-DCMAKE_ANDROID_NDK=' + ndk_dir,
67
                    '-DCMAKE_ANDROID_API={api}'.format(api=self.ctx.ndk_api),
68
                    '-DCMAKE_BUILD_TYPE=Release',
69
                    '-DCMAKE_INSTALL_PREFIX={}'.format(install_target),
70
                    '-DCBLAS=ON',
71
                    '-DBUILD_SHARED_LIBS=ON',
72
                    ]
73
            if arch.arch == 'armeabi-v7a':
×
74
                opts.append('-DCMAKE_ANDROID_ARM_NEON=ON')
×
75
            shprint(sh.cmake, source_dir, *opts, _env=env)
×
76
            shprint(sh.make, '-j' + str(cpu_count()), _env=env)
×
77
            shprint(sh.make, 'install', _env=env)
×
78

79

80
recipe = LapackRecipe()
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