2018-11-02 11:44:25 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-11-10 01:40:55 +01:00
|
|
|
import sys
|
2020-05-03 16:23:08 +02:00
|
|
|
from kivy_ios.toolchain import Recipe
|
2019-02-07 10:00:23 +01:00
|
|
|
import logging
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
2018-11-02 11:44:25 +01:00
|
|
|
|
2020-04-25 18:28:16 +02:00
|
|
|
|
2018-11-02 11:44:25 +01:00
|
|
|
class HostpythonAliasRecipe(Recipe):
|
2020-05-05 23:17:44 +02:00
|
|
|
"""
|
|
|
|
Note this recipe was created to handle both hostpython2 and hostpython3.
|
|
|
|
As hostpython2 support was dropped, this could probably be simplified.
|
|
|
|
"""
|
2018-11-02 11:44:25 +01:00
|
|
|
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
|
2020-05-05 23:17:44 +02:00
|
|
|
if "hostpython3" in ctx.wanted_recipes:
|
2018-11-09 19:14:05 +01:00
|
|
|
hostpython = "hostpython3"
|
|
|
|
else:
|
2019-02-07 10:00:23 +01:00
|
|
|
logger.error("No hostpython version set in the build.")
|
2020-05-05 23:17:44 +02:00
|
|
|
logger.error("Add python3 in your recipes:")
|
2019-02-07 10:00:23 +01:00
|
|
|
logger.error("./toolchain.py build python3 ...")
|
2018-11-10 01:40:55 +01:00
|
|
|
sys.exit(1)
|
|
|
|
if hostpython:
|
2018-11-02 11:44:25 +01:00
|
|
|
self.depends = [hostpython]
|
|
|
|
|
2020-04-25 18:28:16 +02:00
|
|
|
|
2018-11-02 11:44:25 +01:00
|
|
|
recipe = HostpythonAliasRecipe()
|