Add python depends
This commit is contained in:
parent
085d04b7aa
commit
85177f51ec
2 changed files with 41 additions and 29 deletions
|
@ -18,6 +18,7 @@ class KivyRecipe(CythonRecipe):
|
||||||
library = "libkivy.a"
|
library = "libkivy.a"
|
||||||
depends = ["sdl2", "sdl2_image", "sdl2_mixer", "sdl2_ttf", "ios",
|
depends = ["sdl2", "sdl2_image", "sdl2_mixer", "sdl2_ttf", "ios",
|
||||||
"pyobjus", "python", "host_setuptools3"]
|
"pyobjus", "python", "host_setuptools3"]
|
||||||
|
python_depends = ["certifi"]
|
||||||
pbx_frameworks = ["OpenGLES", "Accelerate", "CoreMedia", "CoreVideo"]
|
pbx_frameworks = ["OpenGLES", "Accelerate", "CoreMedia", "CoreVideo"]
|
||||||
pre_build_ext = True
|
pre_build_ext = True
|
||||||
|
|
||||||
|
|
|
@ -424,6 +424,7 @@ class Recipe:
|
||||||
"archs": [],
|
"archs": [],
|
||||||
"depends": [],
|
"depends": [],
|
||||||
"optional_depends": [],
|
"optional_depends": [],
|
||||||
|
"python_depends": [],
|
||||||
"library": None,
|
"library": None,
|
||||||
"libraries": [],
|
"libraries": [],
|
||||||
"include_dir": None,
|
"include_dir": None,
|
||||||
|
@ -814,6 +815,8 @@ class Recipe:
|
||||||
self.install_frameworks()
|
self.install_frameworks()
|
||||||
logger.info("Install sources for {}".format(self.name))
|
logger.info("Install sources for {}".format(self.name))
|
||||||
self.install_sources()
|
self.install_sources()
|
||||||
|
logger.info("Install python deps for {}".format(self.name))
|
||||||
|
self.install_python_deps()
|
||||||
logger.info("Install {}".format(self.name))
|
logger.info("Install {}".format(self.name))
|
||||||
self.install()
|
self.install()
|
||||||
|
|
||||||
|
@ -929,6 +932,11 @@ class Recipe:
|
||||||
ensure_dir(dirname(dest))
|
ensure_dir(dirname(dest))
|
||||||
shutil.copy(src_dir, dest)
|
shutil.copy(src_dir, dest)
|
||||||
|
|
||||||
|
@cache_execution
|
||||||
|
def install_python_deps(self):
|
||||||
|
for dep in self.python_depends:
|
||||||
|
_pip(["install", dep])
|
||||||
|
|
||||||
@cache_execution
|
@cache_execution
|
||||||
def install(self):
|
def install(self):
|
||||||
pass
|
pass
|
||||||
|
@ -1126,6 +1134,37 @@ def ensure_recipes_loaded(ctx):
|
||||||
recipe.init_with_ctx(ctx)
|
recipe.init_with_ctx(ctx)
|
||||||
|
|
||||||
|
|
||||||
|
def _pip(args):
|
||||||
|
ctx = Context()
|
||||||
|
for recipe in Recipe.list_recipes():
|
||||||
|
key = "{}.build_all".format(recipe)
|
||||||
|
if key not in ctx.state:
|
||||||
|
continue
|
||||||
|
recipe = Recipe.get_recipe(recipe, ctx)
|
||||||
|
recipe.init_with_ctx(ctx)
|
||||||
|
if not hasattr(ctx, "site_packages_dir"):
|
||||||
|
logger.error("python must be compiled before using pip")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
pip_env = {
|
||||||
|
"CC": "/bin/false",
|
||||||
|
"CXX": "/bin/false",
|
||||||
|
"PYTHONPATH": ctx.site_packages_dir,
|
||||||
|
"PYTHONOPTIMIZE": "2",
|
||||||
|
# "PIP_INSTALL_TARGET": ctx.site_packages_dir
|
||||||
|
}
|
||||||
|
|
||||||
|
pip_path = join(ctx.dist_dir, 'hostpython3', 'bin', 'pip3')
|
||||||
|
|
||||||
|
if len(args) > 1 and args[0] == "install":
|
||||||
|
pip_args = ["--isolated", "--ignore-installed", "--prefix", ctx.python_prefix]
|
||||||
|
args = ["install"] + pip_args + args[1:]
|
||||||
|
|
||||||
|
logger.error("Executing pip with: {}".format(args))
|
||||||
|
pip_cmd = sh.Command(pip_path)
|
||||||
|
shprint(pip_cmd, *args, _env=pip_env)
|
||||||
|
|
||||||
|
|
||||||
def update_pbxproj(filename, pbx_frameworks=None):
|
def update_pbxproj(filename, pbx_frameworks=None):
|
||||||
# list all the compiled recipes
|
# list all the compiled recipes
|
||||||
ctx = Context()
|
ctx = Context()
|
||||||
|
@ -1415,35 +1454,7 @@ pip Install a pip dependency into the distribution
|
||||||
self.pip()
|
self.pip()
|
||||||
|
|
||||||
def pip(self):
|
def pip(self):
|
||||||
ctx = Context()
|
_pip(sys.argv[2:])
|
||||||
for recipe in Recipe.list_recipes():
|
|
||||||
key = "{}.build_all".format(recipe)
|
|
||||||
if key not in ctx.state:
|
|
||||||
continue
|
|
||||||
recipe = Recipe.get_recipe(recipe, ctx)
|
|
||||||
recipe.init_with_ctx(ctx)
|
|
||||||
if not hasattr(ctx, "site_packages_dir"):
|
|
||||||
logger.error("python must be compiled before using pip")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
pip_env = {
|
|
||||||
"CC": "/bin/false",
|
|
||||||
"CXX": "/bin/false",
|
|
||||||
"PYTHONPATH": ctx.site_packages_dir,
|
|
||||||
"PYTHONOPTIMIZE": "2",
|
|
||||||
# "PIP_INSTALL_TARGET": ctx.site_packages_dir
|
|
||||||
}
|
|
||||||
pip_path = join(ctx.dist_dir, 'hostpython3', 'bin', 'pip3')
|
|
||||||
pip_args = []
|
|
||||||
if len(sys.argv) > 2 and sys.argv[2] == "install":
|
|
||||||
pip_args = ["--isolated", "--ignore-installed", "--prefix", ctx.python_prefix]
|
|
||||||
args = [pip_path] + [sys.argv[2]] + pip_args + sys.argv[3:]
|
|
||||||
else:
|
|
||||||
args = [pip_path] + pip_args + sys.argv[2:]
|
|
||||||
|
|
||||||
import os
|
|
||||||
logger.error("Executing pip with: {}".format(args))
|
|
||||||
os.execve(pip_path, args, pip_env)
|
|
||||||
|
|
||||||
def launchimage(self):
|
def launchimage(self):
|
||||||
import xcassets
|
import xcassets
|
||||||
|
|
Loading…
Add table
Reference in a new issue