@@ -42,13 +42,19 @@ def __repr__(self):
42
42
return str (self )
43
43
44
44
@classmethod
45
- def get_distribution (cls , ctx , name = None , recipes = [],
46
- ndk_api = None ,
47
- arch_name = None ,
48
- force_build = False ,
49
- extra_dist_dirs = [],
50
- require_perfect_match = False ,
51
- allow_replace_dist = True ):
45
+ def get_distribution (
46
+ cls ,
47
+ ctx ,
48
+ * ,
49
+ arch_name , # required keyword argument: there is no sensible default
50
+ name = None ,
51
+ recipes = [],
52
+ ndk_api = None ,
53
+ force_build = False ,
54
+ extra_dist_dirs = [],
55
+ require_perfect_match = False ,
56
+ allow_replace_dist = True
57
+ ):
52
58
'''Takes information about the distribution, and decides what kind of
53
59
distribution it will be.
54
60
@@ -67,6 +73,7 @@ def get_distribution(cls, ctx, name=None, recipes=[],
67
73
arch_name : str
68
74
The target architecture name to compile against, included in the dist because
69
75
it cannot be changed later during APK packaging.
76
+ This is a required, keyword-only argument.
70
77
recipes : list
71
78
The recipes that the distribution must contain.
72
79
force_download: bool
@@ -97,12 +104,13 @@ def get_distribution(cls, ctx, name=None, recipes=[],
97
104
d for d in possible_dists if
98
105
(d .name == name ) and (arch_name in d .archs )]
99
106
100
- # There should only be one folder with a given dist name *and* arch.
101
- # We could check that here, but for compatibility let's let it slide
102
- # and just record the details of one of them. We only use this data to
103
- # possibly fail the build later, so it doesn't really matter if there
104
- # was more than one clash.
105
- folder_match_dist = possible_dists [0 ]
107
+ if possible_dists :
108
+ # There should only be one folder with a given dist name *and* arch.
109
+ # We could check that here, but for compatibility let's let it slide
110
+ # and just record the details of one of them. We only use this data to
111
+ # possibly fail the build later, so it doesn't really matter if there
112
+ # was more than one clash.
113
+ folder_match_dist = possible_dists [0 ]
106
114
107
115
# 1) Check if any existing dists meet the requirements
108
116
_possible_dists = []
@@ -155,7 +163,7 @@ def get_distribution(cls, ctx, name=None, recipes=[],
155
163
req_recipes = ', ' .join (recipes ),
156
164
dist_recipes = ', ' .join (folder_match_dist .recipes )))
157
165
158
- assert len (folder_match_dist ) < 2
166
+ assert len (possible_dists ) < 2
159
167
160
168
# If we got this far, we need to build a new dist
161
169
dist = Distribution (ctx )
@@ -171,7 +179,10 @@ def get_distribution(cls, ctx, name=None, recipes=[],
171
179
dist .name = name
172
180
dist .dist_dir = join (
173
181
ctx .dist_dir ,
174
- generate_dist_folder_name (name , [arch_name ])
182
+ generate_dist_folder_name (
183
+ name ,
184
+ [arch_name ] if arch_name is not None else None ,
185
+ )
175
186
)
176
187
dist .recipes = recipes
177
188
dist .ndk_api = ctx .ndk_api
@@ -258,6 +269,7 @@ def pretty_log_dists(dists, log_func=info):
258
269
for line in infos :
259
270
log_func ('\t ' + line )
260
271
272
+
261
273
def generate_dist_folder_name (base_dist_name , arch_names = None ):
262
274
"""Generate the distribution folder name to use, based on a
263
275
combination of the input arguments.
0 commit comments