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

kivy / python-for-android / 6215290912

17 Sep 2023 06:49PM UTC coverage: 59.095% (+1.4%) from 57.68%
6215290912

push

github

web-flow
Merge pull request #2891 from misl6/release-2023.09.16

* Update `cffi` recipe for Python 3.10 (#2800)

* Update __init__.py

version bump to 1.15.1

* Update disable-pkg-config.patch

adjust patch for 1.15.1

* Use build rather than pep517 for building (#2784)

pep517 has been renamed to pyproject-hooks, and as a consequence all of
the deprecated functionality has been removed. build now provides the
functionality required, and since we are only interested in the
metadata, we can leverage a helper function for that. I've also removed
all of the subprocess machinery for calling the wrapping function, since
it appears to not be as noisy as pep517.

* Bump actions/setup-python and actions/checkout versions, as old ones are deprecated (#2827)

* Removes `mysqldb` recipe as does not support Python 3 (#2828)

* Removes `Babel` recipe as it's not needed anymore. (#2826)

* Remove dateutil recipe, as it's not needed anymore (#2829)

* Optimize CI runs, by avoiding unnecessary rebuilds (#2833)

* Remove `pytz` recipe, as it's not needed anymore (#2830)

* `freetype` recipe: Changed the url to use https as http doesn't work (#2846)

* Fix `vlc` recipe build (#2841)

* Correct sys_platform (#2852)

On Window, sys.platform = "win32".

I think "nt" is a reference to os.name.

* Fix code string - quickstart.rst

* Bump `kivy` version to `2.2.1` (#2855)

* Use a pinned version of `Cython` for now, as most of the recipes are incompatible with `Cython==3.x.x` (#2862)

* Automatically generate required pre-requisites (#2858)

`get_required_prerequisites()` maintains a list of Prerequisites required by each platform.

But that same information is already stored in each Prerequisite class.

Rather than rather than maintaining two lists which might become inconsistent, auto-generate one.

* Use `platform.uname` instead of `os.uname` (#2857)

Advantages:

- Works cross platform, not just Unix.
- Is a namedtuple, ... (continued)

944 of 2241 branches covered (0.0%)

Branch coverage included in aggregate %.

174 of 272 new or added lines in 32 files covered. (63.97%)

9 existing lines in 5 files now uncovered.

4725 of 7352 relevant lines covered (64.27%)

2.56 hits per line

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

38.46
/pythonforandroid/patching.py
1
"""
2
    Helper functions for recipes.
3

4
    Recipes must supply a list of patches.
5

6
    Patches consist of a filename and an optional conditional, which is
7
    any function of the form:
8
        def patch_check(arch: string, recipe : Recipe) -> bool
9

10
    This library provides some helpful conditionals and mechanisms to
11
    join multiple conditionals.
12

13
    Example:
14
        patches = [
15
            ("linux_or_darwin_only.patch",
16
             check_any(is_linux, is_darwin),
17
            ("recent_android_API.patch",
18
             is_apt_gte(27)),
19
            ]
20
"""
21
from platform import uname
4✔
22
from packaging.version import Version
4✔
23

24

25
# Platform checks
26

27

28
def is_platform(platform):
4✔
29
    """
30
    Returns true if the host platform matches the parameter given.
31
    """
32

33
    def check(arch, recipe):
4✔
NEW
34
        return uname().system.lower() == platform.lower()
×
35

36
    return check
4✔
37

38

39
is_linux = is_platform("Linux")
4✔
40
is_darwin = is_platform("Darwin")
4✔
41
is_windows = is_platform("Windows")
4✔
42

43

44
def is_arch(xarch):
4✔
45
    """
46
    Returns true if the target architecture platform matches the parameter
47
    given.
48
    """
49

NEW
50
    def check(arch):
×
51
        return arch.arch == xarch
×
52

NEW
53
    return check
×
54

55

56
# Android API comparisons:
57
# Return true if the Android API level being targeted
58
# is equal (or >, >=, <, <= as appropriate) the given parameter
59

60

61
def is_api(apiver: int):
4✔
NEW
62
    def check(arch, recipe):
×
NEW
63
        return recipe.ctx.android_api == apiver
×
64

NEW
65
    return check
×
66

67

68
def is_api_gt(apiver: int):
4✔
NEW
69
    def check(arch, recipe):
×
70
        return recipe.ctx.android_api > apiver
×
71

NEW
72
    return check
×
73

74

75
def is_api_gte(apiver: int):
4✔
NEW
76
    def check(arch, recipe):
×
77
        return recipe.ctx.android_api >= apiver
×
78

NEW
79
    return check
×
80

81

82
def is_api_lt(apiver: int):
4✔
NEW
83
    def check(arch, recipe):
×
84
        return recipe.ctx.android_api < apiver
×
85

NEW
86
    return check
×
87

88

89
def is_api_lte(apiver: int):
4✔
NEW
90
    def check(arch, recipe):
×
91
        return recipe.ctx.android_api <= apiver
×
92

NEW
93
    return check
×
94

95

96
# Android API comparisons:
97

98

99
def is_ndk(ndk):
4✔
100
    """
101
    Return true if the Minimum Supported Android NDK level being targeted
102
    is equal the given parameter (which should be an AndroidNDK instance)
103
    """
104

NEW
105
    def check(arch, recipe):
×
106
        return recipe.ctx.ndk == ndk
×
107

NEW
108
    return check
×
109

110

111
# Recipe Version comparisons:
112
# These compare the Recipe's version with the provided string (or
113
# Packaging.Version).
114
#
115
# Warning: Both strings must conform to PEP 440 - e.g. "3.2.1" or "1.0rc1"
116

117

118
def is_version_gt(version):
4✔
119
    """Return true if the Recipe's version is greater"""
120

NEW
121
    def check(arch, recipe):
×
NEW
122
        return Version(recipe.version) > Version(version)
×
123

NEW
124
    return check
×
125

126

127
def is_version_lt(version):
4✔
128
    """Return true if the Recipe's version is less than"""
129

NEW
130
    def check(arch, recipe):
×
NEW
131
        return Version(recipe.version) < Version(version)
×
132

NEW
133
    return check
×
134

135

136
def version_starts_with(version_prefix):
4✔
137
    def check(arch, recipe):
4✔
NEW
138
        return recipe.version.startswith(version_prefix)
×
139

140
    return check
4✔
141

142

143
# Will Build
144

145

146
def will_build(recipe_name):
4✔
147
    """Return true if the recipe with this name is planned to be included in
148
    the distribution."""
149

150
    def check(arch, recipe):
4✔
NEW
151
        return recipe_name in recipe.ctx.recipe_build_order
×
152

153
    return check
4✔
154

155

156
# Conjunctions
157

158

159
def check_all(*patch_checks):
4✔
160
    """
161
    Given a collection of patch_checks as params, return if all returned true.
162
    """
163

NEW
164
    def check(arch, recipe):
×
NEW
165
        return all(patch_check(arch, recipe) for patch_check in patch_checks)
×
166

NEW
167
    return check
×
168

169

170
def check_any(*patch_checks):
4✔
171
    """
172
    Given a collection of patch_checks as params, return if any returned true.
173
    """
174

NEW
175
    def check(arch, recipe):
×
NEW
176
        return any(patch_check(arch, recipe) for patch_check in patch_checks)
×
177

NEW
178
    return check
×
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