fix recipes order with hostpython/python alias that didnt work in the first run

This commit is contained in:
Mathieu Virbel 2018-11-09 19:14:05 +01:00
parent 7c8a2c6c4b
commit 0e52dab468
3 changed files with 19 additions and 6 deletions

View file

@ -7,9 +7,15 @@ class HostpythonAliasRecipe(Recipe):
def init_after_import(self, ctx): def init_after_import(self, ctx):
hostpython = ctx.state.get("hostpython") hostpython = ctx.state.get("hostpython")
if not hostpython: if not hostpython:
print("WARNING: no hostpython set yet, so you need to specify") # search in wanted_recipes if it's the first time
print("WARNING: either hostpython2 or hostpython3 in your deps") if "hostpython2" in ctx.wanted_recipes:
else: 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] self.depends = [hostpython]
recipe = HostpythonAliasRecipe() recipe = HostpythonAliasRecipe()

View file

@ -7,9 +7,15 @@ class PythonAliasRecipe(Recipe):
def init_after_import(self, ctx): def init_after_import(self, ctx):
python = ctx.state.get("python") python = ctx.state.get("python")
if not python: if not python:
print("WARNING: no python set yet, so you need to specify") # search in wanted_recipes if it's the first time
print("WARNING: either python2 or python3 in your deps") if "python2" in ctx.wanted_recipes:
else: 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] self.depends = [python]
recipe = PythonAliasRecipe() recipe = PythonAliasRecipe()

View file

@ -1051,6 +1051,7 @@ def build_recipes(names, ctx):
# gather all the dependencies # gather all the dependencies
print("Want to build {}".format(names)) print("Want to build {}".format(names))
graph = Graph() graph = Graph()
ctx.wanted_recipes = names[:]
recipe_to_load = names recipe_to_load = names
recipe_loaded = [] recipe_loaded = []
while names: while names: