This function expands to lists of all different available alternative recipe combinations, with the dependencies added in ONLY for all the not-with-alternative recipes. (So this is like the deps graph very simplified and incomplete, but hopefully good enough for mos
(recipes, ctx)
| 451 | |
| 452 | |
| 453 | def expand_dependencies(recipes, ctx): |
| 454 | """ This function expands to lists of all different available |
| 455 | alternative recipe combinations, with the dependencies added in |
| 456 | ONLY for all the not-with-alternative recipes. |
| 457 | (So this is like the deps graph very simplified and incomplete, but |
| 458 | hopefully good enough for most basic bootstrap compatibility checks) |
| 459 | """ |
| 460 | |
| 461 | # Add in all the deps of recipes where there is no alternative: |
| 462 | recipes_with_deps = list(recipes) |
| 463 | for entry in recipes: |
| 464 | if not isinstance(entry, (tuple, list)) or len(entry) == 1: |
| 465 | if isinstance(entry, (tuple, list)): |
| 466 | entry = entry[0] |
| 467 | try: |
| 468 | recipe = Recipe.get_recipe(entry, ctx) |
| 469 | recipes_with_deps += recipe.depends |
| 470 | except ValueError: |
| 471 | # it's a pure python package without a recipe, so we |
| 472 | # don't know the dependencies...skipping for now |
| 473 | pass |
| 474 | |
| 475 | # Split up lists by available alternatives: |
| 476 | recipe_lists = [[]] |
| 477 | for recipe in recipes_with_deps: |
| 478 | if isinstance(recipe, (tuple, list)): |
| 479 | new_recipe_lists = [] |
| 480 | for alternative in recipe: |
| 481 | for old_list in recipe_lists: |
| 482 | new_list = [i for i in old_list] |
| 483 | new_list.append(alternative) |
| 484 | new_recipe_lists.append(new_list) |
| 485 | recipe_lists = new_recipe_lists |
| 486 | else: |
| 487 | for existing_list in recipe_lists: |
| 488 | existing_list.append(recipe) |
| 489 | return recipe_lists |