diff --git a/recipes/hostpython.py b/recipes/hostpython.py index 3291cc3..f5c6cd1 100644 --- a/recipes/hostpython.py +++ b/recipes/hostpython.py @@ -7,9 +7,15 @@ class HostpythonAliasRecipe(Recipe): def init_after_import(self, ctx): hostpython = ctx.state.get("hostpython") if not hostpython: - print("WARNING: no hostpython set yet, so you need to specify") - print("WARNING: either hostpython2 or hostpython3 in your deps") - else: + # search in wanted_recipes if it's the first time + if "hostpython2" in ctx.wanted_recipes: + hostpython = "hostpython2" + elif "hostpython3" in ctx.wanted_recipes: + hostpython = "hostpython3" + else: + print("WARNING: no hostpython set yet, so you need to specify") + print("WARNING: either hostpython2 or hostpython3 in your deps") + if python: self.depends = [hostpython] recipe = HostpythonAliasRecipe() diff --git a/recipes/python.py b/recipes/python.py index 359f03f..d6e713f 100644 --- a/recipes/python.py +++ b/recipes/python.py @@ -7,9 +7,15 @@ class PythonAliasRecipe(Recipe): def init_after_import(self, ctx): python = ctx.state.get("python") if not python: - print("WARNING: no python set yet, so you need to specify") - print("WARNING: either python2 or python3 in your deps") - else: + # search in wanted_recipes if it's the first time + if "python2" in ctx.wanted_recipes: + python = "python2" + elif "python3" in ctx.wanted_recipes: + python = "python3" + else: + print("WARNING: no python set yet, so you need to specify") + print("WARNING: either python2 or python3 in your deps") + if python: self.depends = [python] recipe = PythonAliasRecipe() diff --git a/toolchain.py b/toolchain.py index 08e8b52..d81f60e 100755 --- a/toolchain.py +++ b/toolchain.py @@ -1051,6 +1051,7 @@ def build_recipes(names, ctx): # gather all the dependencies print("Want to build {}".format(names)) graph = Graph() + ctx.wanted_recipes = names[:] recipe_to_load = names recipe_loaded = [] while names: