set PYTHONHOME for hostpython
This commit is contained in:
parent
88b5b22e67
commit
1ef0fd54e3
4 changed files with 42 additions and 1 deletions
|
@ -13,6 +13,7 @@ class HostpythonRecipe(Recipe):
|
||||||
|
|
||||||
def init_with_ctx(self, ctx):
|
def init_with_ctx(self, ctx):
|
||||||
super(HostpythonRecipe, self).init_with_ctx(ctx)
|
super(HostpythonRecipe, self).init_with_ctx(ctx)
|
||||||
|
#self.ctx.hostpython = "\"" + join("PYTHONHOME=",self.ctx.dist_dir, "hostpython") + " " + join(self.ctx.dist_dir, "hostpython", "bin", "python") + "\""
|
||||||
self.ctx.hostpython = join(self.ctx.dist_dir, "hostpython", "bin", "python")
|
self.ctx.hostpython = join(self.ctx.dist_dir, "hostpython", "bin", "python")
|
||||||
self.ctx.hostpgen = join(self.ctx.dist_dir, "hostpython", "bin", "pgen")
|
self.ctx.hostpgen = join(self.ctx.dist_dir, "hostpython", "bin", "pgen")
|
||||||
print("Global: hostpython located at {}".format(self.ctx.hostpython))
|
print("Global: hostpython located at {}".format(self.ctx.hostpython))
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
from toolchain import CythonRecipe
|
from toolchain import CythonRecipe
|
||||||
from os.path import join
|
from os.path import join
|
||||||
|
|
||||||
|
from sys import stdout
|
||||||
|
import sh
|
||||||
|
|
||||||
|
def shprint(command, *args, **kwargs):
|
||||||
|
kwargs["_iter"] = True
|
||||||
|
kwargs["_out_bufsize"] = 1
|
||||||
|
kwargs["_err_to_out"] = True
|
||||||
|
for line in command(*args, **kwargs):
|
||||||
|
stdout.write(line)
|
||||||
|
|
||||||
|
|
||||||
class KivyRecipe(CythonRecipe):
|
class KivyRecipe(CythonRecipe):
|
||||||
version = "1.9.0"
|
version = "1.9.0"
|
||||||
|
@ -21,7 +31,21 @@ class KivyRecipe(CythonRecipe):
|
||||||
|
|
||||||
def build_arch(self, arch):
|
def build_arch(self, arch):
|
||||||
self._patch_setup()
|
self._patch_setup()
|
||||||
super(KivyRecipe, self).build_arch(arch)
|
build_env = self.get_recipe_env(arch)
|
||||||
|
build_env["PYTHONHOME"] = join(self.ctx.dist_dir, "hostpython")
|
||||||
|
#print 'build_env=', build_env
|
||||||
|
hostpython = sh.Command(self.ctx.hostpython)
|
||||||
|
#hostpython = sh.Command("/usr/bin/python2.7")
|
||||||
|
if self.pre_build_ext:
|
||||||
|
try:
|
||||||
|
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||||
|
_env=build_env)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
self.cythonize_build()
|
||||||
|
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||||
|
_env=build_env)
|
||||||
|
self.biglink()
|
||||||
|
|
||||||
def _patch_setup(self):
|
def _patch_setup(self):
|
||||||
# patch setup to remove some functionnalities
|
# patch setup to remove some functionnalities
|
||||||
|
|
|
@ -8,6 +8,7 @@ class PythonRecipe(Recipe):
|
||||||
version = "2.7.1"
|
version = "2.7.1"
|
||||||
url = "https://www.python.org/ftp/python/{version}/Python-{version}.tar.bz2"
|
url = "https://www.python.org/ftp/python/{version}/Python-{version}.tar.bz2"
|
||||||
depends = ["hostpython", "libffi", ]
|
depends = ["hostpython", "libffi", ]
|
||||||
|
#depends = ["libffi", ]
|
||||||
optional_depends = ["openssl"]
|
optional_depends = ["openssl"]
|
||||||
library = "libpython2.7.a"
|
library = "libpython2.7.a"
|
||||||
pbx_libraries = ["libz", "libbz2", "libsqlite3"]
|
pbx_libraries = ["libz", "libbz2", "libsqlite3"]
|
||||||
|
@ -61,6 +62,10 @@ class PythonRecipe(Recipe):
|
||||||
"CROSS_COMPILE_TARGET=yes",
|
"CROSS_COMPILE_TARGET=yes",
|
||||||
"HOSTPYTHON={}".format(self.ctx.hostpython),
|
"HOSTPYTHON={}".format(self.ctx.hostpython),
|
||||||
"HOSTPGEN={}".format(self.ctx.hostpgen))
|
"HOSTPGEN={}".format(self.ctx.hostpgen))
|
||||||
|
# shprint(sh.make, "-j4",
|
||||||
|
# "CROSS_COMPILE_TARGET=yes",
|
||||||
|
# "HOSTPYTHON={}".format("/usr/bin/python2.7"),
|
||||||
|
# "HOSTPGEN={}".format(self.ctx.hostpgen))
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
arch = list(self.filtered_archs)[0]
|
arch = list(self.filtered_archs)[0]
|
||||||
|
@ -74,6 +79,13 @@ class PythonRecipe(Recipe):
|
||||||
"HOSTPYTHON={}".format(self.ctx.hostpython),
|
"HOSTPYTHON={}".format(self.ctx.hostpython),
|
||||||
"prefix={}".format(join(self.ctx.dist_dir, "root", "python")),
|
"prefix={}".format(join(self.ctx.dist_dir, "root", "python")),
|
||||||
_env=build_env)
|
_env=build_env)
|
||||||
|
# shprint(sh.make,
|
||||||
|
# "-C", build_dir,
|
||||||
|
# "install",
|
||||||
|
# "CROSS_COMPILE_TARGET=yes",
|
||||||
|
# "HOSTPYTHON={}".format("/usr/bin/python2.7"),
|
||||||
|
# "prefix={}".format(join(self.ctx.dist_dir, "root", "python")),
|
||||||
|
# _env=build_env)
|
||||||
self.reduce_python()
|
self.reduce_python()
|
||||||
|
|
||||||
def _patch_pyconfig(self):
|
def _patch_pyconfig(self):
|
||||||
|
|
|
@ -816,7 +816,9 @@ class PythonRecipe(Recipe):
|
||||||
print("Install {} into the site-packages".format(name))
|
print("Install {} into the site-packages".format(name))
|
||||||
build_dir = self.get_build_dir(arch.arch)
|
build_dir = self.get_build_dir(arch.arch)
|
||||||
chdir(build_dir)
|
chdir(build_dir)
|
||||||
|
env["PYTHONHOME"] = join(self.ctx.dist_dir, "hostpython")
|
||||||
hostpython = sh.Command(self.ctx.hostpython)
|
hostpython = sh.Command(self.ctx.hostpython)
|
||||||
|
#hostpython = sh.Command("/usr/bin/python2.7")
|
||||||
iosbuild = join(build_dir, "iosbuild")
|
iosbuild = join(build_dir, "iosbuild")
|
||||||
shprint(hostpython, "setup.py", "install", "-O2",
|
shprint(hostpython, "setup.py", "install", "-O2",
|
||||||
"--prefix", iosbuild,
|
"--prefix", iosbuild,
|
||||||
|
@ -879,7 +881,9 @@ class CythonRecipe(PythonRecipe):
|
||||||
|
|
||||||
def build_arch(self, arch):
|
def build_arch(self, arch):
|
||||||
build_env = self.get_recipe_env(arch)
|
build_env = self.get_recipe_env(arch)
|
||||||
|
build_env["PYTHONHOME"] = join(self.ctx.dist_dir, "hostpython")
|
||||||
hostpython = sh.Command(self.ctx.hostpython)
|
hostpython = sh.Command(self.ctx.hostpython)
|
||||||
|
#hostpython = sh.Command("/usr/bin/python2.7")
|
||||||
if self.pre_build_ext:
|
if self.pre_build_ext:
|
||||||
try:
|
try:
|
||||||
shprint(hostpython, "setup.py", "build_ext", "-g",
|
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||||
|
|
Loading…
Add table
Reference in a new issue