kivy-ios/kivy_ios/recipes/hostpython.py
Andre Miras 56431b6922 Moving to dedicated kivy_ios/ package directory
- updates all imports to prefix kivy_ios
- adds basic `setup.py` file
- adds a simple `toolchain.py` to the root folder for compat

Makes it possible to install kivy-ios from PyPI:
```
pip install kivy-ios
toolchain --help
```
Note the `rebuild_updated_recipes.py` is expected to fail as we
moved all the recipes.

This is a working, but unperfect iteration that come with limitations
we would address in subsequent pull requests, such as:
- the new usage is not yet documented
- CI is not testing the source distribution creation and install
- Continuous Delivery to PyPI is not in place
- `toolchain` binary is a bit too generic name
- we're still vendoring things under `tools/`
2020-05-03 23:29:41 +02:00

29 lines
907 B
Python

# -*- coding: utf-8 -*-
import sys
from kivy_ios.toolchain import Recipe
import logging
logger = logging.getLogger(__name__)
class HostpythonAliasRecipe(Recipe):
is_alias = True
def init_after_import(self, ctx):
hostpython = ctx.state.get("hostpython")
if not hostpython:
# 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:
logger.error("No hostpython version set in the build.")
logger.error("Add python2 or python3 in your recipes:")
logger.error("./toolchain.py build python3 ...")
sys.exit(1)
if hostpython:
self.depends = [hostpython]
recipe = HostpythonAliasRecipe()