Skip to content

Commit 98226f0

Browse files
authored
Merge pull request #1617 from inclement/fix_opt_depends
Made recipe graph resolution respect opt_depends
2 parents 8739241 + d30caa4 commit 98226f0

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

pythonforandroid/graph.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def conflicts(self, name):
2525
return False
2626

2727

28-
def recursively_collect_orders(name, ctx, orders=[]):
28+
def recursively_collect_orders(name, ctx, all_inputs, orders=[]):
2929
'''For each possible recipe ordering, try to add the new recipe name
3030
to that order. Recursively do the same thing with all the
3131
dependencies of each recipe.
@@ -40,6 +40,11 @@ def recursively_collect_orders(name, ctx, orders=[]):
4040
dependencies = [([dependency] if not isinstance(
4141
dependency, (list, tuple))
4242
else dependency) for dependency in recipe.depends]
43+
44+
# handle opt_depends: these impose requirements on the build
45+
# order only if already present in the list of recipes to build
46+
dependencies.extend([[d] for d in recipe.get_opt_depends_in_list(all_inputs)])
47+
4348
if recipe.conflicts is None:
4449
conflicts = []
4550
else:
@@ -68,7 +73,7 @@ def recursively_collect_orders(name, ctx, orders=[]):
6873
dependency_new_orders = [new_order]
6974
for dependency in dependency_set:
7075
dependency_new_orders = recursively_collect_orders(
71-
dependency, ctx, dependency_new_orders)
76+
dependency, ctx, all_inputs, dependency_new_orders)
7277

7378
new_orders.extend(dependency_new_orders)
7479

@@ -109,7 +114,7 @@ def get_recipe_order_and_bootstrap(ctx, names, bs=None):
109114
new_possible_orders = [RecipeOrder(ctx)]
110115
for name in name_set:
111116
new_possible_orders = recursively_collect_orders(
112-
name, ctx, orders=new_possible_orders)
117+
name, ctx, name_set, orders=new_possible_orders)
113118
possible_orders.extend(new_possible_orders)
114119

115120
# turn each order graph into a linear list if possible

pythonforandroid/recipe.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ def check_recipe_choices(self):
241241
recipes.append(recipe)
242242
return sorted(recipes)
243243

244+
def get_opt_depends_in_list(self, recipes):
245+
'''Given a list of recipe names, returns those that are also in
246+
self.opt_depends.
247+
'''
248+
return [recipe for recipe in recipes if recipe in self.opt_depends]
249+
244250
def get_build_container_dir(self, arch):
245251
'''Given the arch name, returns the directory where it will be
246252
built.

0 commit comments

Comments
 (0)