2015-02-25 13:37:52 +01:00
|
|
|
from toolchain import CythonRecipe, shprint
|
2015-02-18 03:01:22 +01:00
|
|
|
from os.path import join
|
|
|
|
import sh
|
|
|
|
|
|
|
|
|
2015-02-25 13:37:52 +01:00
|
|
|
class PyobjusRecipe(CythonRecipe):
|
2015-02-18 03:01:22 +01:00
|
|
|
version = "master"
|
|
|
|
url = "https://github.com/kivy/pyobjus/archive/{version}.zip"
|
|
|
|
library = "libpyobjus.a"
|
|
|
|
depends = ["python"]
|
2015-02-25 13:37:52 +01:00
|
|
|
pre_build_ext = True
|
2015-02-18 03:01:22 +01:00
|
|
|
|
2015-02-25 13:37:52 +01:00
|
|
|
def get_recipe_env(self, arch):
|
|
|
|
env = super(PyobjusRecipe, self).get_recipe_env(arch)
|
|
|
|
env["CC"] += " -I{}".format(
|
2015-02-18 03:01:22 +01:00
|
|
|
join(self.ctx.dist_dir, "include", arch.arch, "libffi"))
|
2015-02-25 13:37:52 +01:00
|
|
|
return env
|
2015-02-18 03:01:22 +01:00
|
|
|
|
2015-02-25 13:37:52 +01:00
|
|
|
def cythonize_build(self):
|
2015-02-27 10:49:04 +01:00
|
|
|
# don't use the cythonize, pyobjus don't support method rewriting
|
|
|
|
shprint(sh.find, self.build_dir, "-iname", "*.pyx",
|
|
|
|
"-exec", "cython", "{}", ";")
|
|
|
|
# ffi is installed somewhere else, this include doesn't work
|
|
|
|
# XXX ideally, we need to fix libffi installation...
|
2015-02-18 03:01:22 +01:00
|
|
|
shprint(sh.sed,
|
|
|
|
"-i.bak",
|
|
|
|
"s/ffi\///g",
|
|
|
|
"pyobjus/pyobjus.c")
|
|
|
|
|
|
|
|
recipe = PyobjusRecipe()
|
|
|
|
|
|
|
|
|