@@ -86,17 +86,24 @@ def get_distribution(cls, ctx, name=None, recipes=[],
86
86
87
87
existing_dists = Distribution .get_distributions (ctx )
88
88
89
- possible_dists = existing_dists
89
+ possible_dists = existing_dists [:]
90
90
91
- name_match_dists = []
91
+ # Will hold dists that would be built in the same folder as an existing dist
92
+ folder_match_dist = None
92
93
93
94
# 0) Check if a dist with that name and architecture already exists
94
- # There may be more than one dist with the same name but different arch targets
95
95
if name is not None and name :
96
96
possible_dists = [
97
97
d for d in possible_dists if
98
98
(d .name == name ) and (arch_name in d .archs )]
99
99
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 ]
106
+
100
107
# 1) Check if any existing dists meet the requirements
101
108
_possible_dists = []
102
109
for dist in possible_dists :
@@ -133,22 +140,22 @@ def get_distribution(cls, ctx, name=None, recipes=[],
133
140
.format (dist .name ))
134
141
return dist
135
142
136
- assert len (possible_dists ) < 2
137
-
138
143
# If there was a name match but we didn't already choose it,
139
144
# then the existing dist is incompatible with the requested
140
145
# configuration and the build cannot continue
141
- if name_match_dists and not allow_replace_dist :
146
+ if folder_match_dist is not None and not allow_replace_dist :
142
147
raise BuildInterruptingException (
143
148
'Asked for dist with name {name} with recipes ({req_recipes}) and '
144
149
'NDK API {req_ndk_api}, but a dist '
145
150
'with this name already exists and has either incompatible recipes '
146
151
'({dist_recipes}) or NDK API {dist_ndk_api}' .format (
147
152
name = name ,
148
153
req_ndk_api = ndk_api ,
149
- dist_ndk_api = name_match_dist .ndk_api ,
154
+ dist_ndk_api = folder_match_dist .ndk_api ,
150
155
req_recipes = ', ' .join (recipes ),
151
- dist_recipes = ', ' .join (name_match_dist .recipes )))
156
+ dist_recipes = ', ' .join (folder_match_dist .recipes )))
157
+
158
+ assert len (folder_match_dist ) < 2
152
159
153
160
# If we got this far, we need to build a new dist
154
161
dist = Distribution (ctx )
@@ -170,7 +177,6 @@ def get_distribution(cls, ctx, name=None, recipes=[],
170
177
dist .ndk_api = ctx .ndk_api
171
178
dist .archs = [arch_name ]
172
179
173
-
174
180
return dist
175
181
176
182
def folder_exists (self ):
0 commit comments