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):
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()

View file

@ -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()

View file

@ -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: