For each possible recipe ordering, try to add the new recipe name to that order. Recursively do the same thing with all the dependencies of each recipe.
(
name, ctx, all_inputs, orders=None, blacklist=None
)
| 62 | |
| 63 | |
| 64 | def recursively_collect_orders( |
| 65 | name, ctx, all_inputs, orders=None, blacklist=None |
| 66 | ): |
| 67 | '''For each possible recipe ordering, try to add the new recipe name |
| 68 | to that order. Recursively do the same thing with all the |
| 69 | dependencies of each recipe. |
| 70 | |
| 71 | ''' |
| 72 | name = name.lower() |
| 73 | if orders is None: |
| 74 | orders = [] |
| 75 | if blacklist is None: |
| 76 | blacklist = set() |
| 77 | try: |
| 78 | recipe = Recipe.get_recipe(name, ctx) |
| 79 | dependencies = get_dependency_tuple_list_for_recipe( |
| 80 | recipe, blacklist=blacklist |
| 81 | ) |
| 82 | |
| 83 | # handle opt_depends: these impose requirements on the build |
| 84 | # order only if already present in the list of recipes to build |
| 85 | dependencies.extend(fix_deplist( |
| 86 | [[d] for d in recipe.get_opt_depends_in_list(all_inputs) |
| 87 | if d.lower() not in blacklist] |
| 88 | )) |
| 89 | |
| 90 | if recipe.conflicts is None: |
| 91 | conflicts = [] |
| 92 | else: |
| 93 | conflicts = [dep.lower() for dep in recipe.conflicts] |
| 94 | except ValueError: |
| 95 | # The recipe does not exist, so we assume it can be installed |
| 96 | # via pip with no extra dependencies |
| 97 | dependencies = [] |
| 98 | conflicts = [] |
| 99 | |
| 100 | new_orders = [] |
| 101 | # for each existing recipe order, see if we can add the new recipe name |
| 102 | for order in orders: |
| 103 | if name in order: |
| 104 | new_orders.append(deepcopy(order)) |
| 105 | continue |
| 106 | if order.conflicts(): |
| 107 | continue |
| 108 | if any([conflict in order for conflict in conflicts]): |
| 109 | continue |
| 110 | |
| 111 | for dependency_set in product(*dependencies): |
| 112 | new_order = deepcopy(order) |
| 113 | new_order[name] = set(dependency_set) |
| 114 | |
| 115 | dependency_new_orders = [new_order] |
| 116 | for dependency in dependency_set: |
| 117 | dependency_new_orders = recursively_collect_orders( |
| 118 | dependency, ctx, all_inputs, dependency_new_orders, |
| 119 | blacklist=blacklist |
| 120 | ) |
| 121 |
no test coverage detected