MCPcopy Index your code
hub / github.com/kivy/python-for-android / obvious_conflict_checker

Function obvious_conflict_checker

pythonforandroid/graph.py:146–240  ·  view source on GitHub ↗

This is a pre-flight check function that will completely ignore recipe order or choosing an actual value in any of the multiple choice tuples/dependencies, and just do a very basic obvious conflict check.

(ctx, name_tuples, blacklist=None)

Source from the content-addressed store, hash-verified

144
145
146def obvious_conflict_checker(ctx, name_tuples, blacklist=None):
147 """ This is a pre-flight check function that will completely ignore
148 recipe order or choosing an actual value in any of the multiple
149 choice tuples/dependencies, and just do a very basic obvious
150 conflict check.
151 """
152 deps_were_added_by = dict()
153 deps = set()
154 if blacklist is None:
155 blacklist = set()
156
157 # Add dependencies for all recipes:
158 to_be_added = [(name_tuple, None) for name_tuple in name_tuples]
159 while len(to_be_added) > 0:
160 current_to_be_added = list(to_be_added)
161 to_be_added = []
162 for (added_tuple, adding_recipe) in current_to_be_added:
163 assert type(added_tuple) is tuple
164 if len(added_tuple) > 1:
165 # No obvious commitment in what to add, don't check it itself
166 # but throw it into deps for later comparing against
167 # (Remember this function only catches obvious issues)
168 deps.add(added_tuple)
169 continue
170
171 name = added_tuple[0]
172 recipe_conflicts = set()
173 recipe_dependencies = []
174 try:
175 # Get recipe to add and who's ultimately adding it:
176 recipe = Recipe.get_recipe(name, ctx)
177 recipe_conflicts = {c.lower() for c in recipe.conflicts}
178 recipe_dependencies = get_dependency_tuple_list_for_recipe(
179 recipe, blacklist=blacklist
180 )
181 except ValueError:
182 pass
183 adder_first_recipe_name = adding_recipe or name
184
185 # Collect the conflicts:
186 triggered_conflicts = []
187 for dep_tuple_list in deps:
188 # See if the new deps conflict with things added before:
189 if set(dep_tuple_list).intersection(
190 recipe_conflicts) == set(dep_tuple_list):
191 triggered_conflicts.append(dep_tuple_list)
192 continue
193
194 # See if what was added before conflicts with the new deps:
195 if len(dep_tuple_list) > 1:
196 # Not an obvious commitment to a specific recipe/dep
197 # to be added, so we won't check.
198 # (remember this function only catches obvious issues)
199 continue
200 try:
201 dep_recipe = Recipe.get_recipe(dep_tuple_list[0], ctx)
202 except ValueError:
203 continue

Calls 4

get_recipeMethod · 0.80
formatMethod · 0.80