2018-11-02 11:44:25 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-11-10 01:40:55 +01:00
|
|
|
import sys
|
2018-11-02 11:44:25 +01:00
|
|
|
from toolchain import Recipe
|
|
|
|
|
|
|
|
class HostpythonAliasRecipe(Recipe):
|
|
|
|
is_alias = True
|
|
|
|
|
|
|
|
def init_after_import(self, ctx):
|
|
|
|
hostpython = ctx.state.get("hostpython")
|
|
|
|
if not hostpython:
|
2018-11-09 19:14:05 +01:00
|
|
|
# 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:
|
2018-11-10 01:40:55 +01:00
|
|
|
print("")
|
|
|
|
print("ERROR: No hostpython version set in the build.")
|
|
|
|
print("ERROR: Add python2 or python3 in your recipes:")
|
|
|
|
print("ERROR: ./toolchain.py build python3 ...")
|
|
|
|
print("")
|
|
|
|
sys.exit(1)
|
|
|
|
if hostpython:
|
2018-11-02 11:44:25 +01:00
|
|
|
self.depends = [hostpython]
|
|
|
|
|
|
|
|
recipe = HostpythonAliasRecipe()
|