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
|
2018-11-02 11:44:25 +01:00
|
|
|
pyver = "-{}".format(self.ctx.python_major)
|
2015-02-27 10:49:04 +01:00
|
|
|
shprint(sh.find, self.build_dir, "-iname", "*.pyx",
|
2018-11-02 11:44:25 +01:00
|
|
|
"-exec", "cython", pyver, "{}", ";")
|
2015-02-27 10:49:04 +01:00
|
|
|
# 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()
|