kivy-ios/recipes/cffi/__init__.py

45 lines
1.5 KiB
Python
Raw Normal View History

2016-10-17 08:55:33 +02:00
from os.path import join
2016-10-14 14:07:10 +02:00
from toolchain import CythonRecipe
from toolchain import shprint
import os
import sh
2016-10-14 14:07:10 +02:00
class CffiRecipe(CythonRecipe):
name = "cffi"
version = "1.8.3"
url = (
"https://pypi.python.org/packages/0a/f3/"
"686af8873b70028fccf67b15c78fd4e4667a3da995007afc71e786d61b0a/"
"cffi-{version}.tar.gz"
)
library = "libcffi.a"
2016-10-14 17:59:39 +02:00
depends = ["libffi", "host_setuptools", "pycparser"]
2016-10-14 14:07:10 +02:00
cythonize = False
2016-10-14 17:59:39 +02:00
def get_recipe_env(self, arch):
env = super(CffiRecipe, self).get_recipe_env(arch)
env["CC"] += " -I{}".format(
join(self.ctx.dist_dir, "include", arch.arch, "libffi"))
return env
def install(self):
arch = list(self.filtered_archs)[0]
build_dir = self.get_build_dir(arch.arch)
os.chdir(build_dir)
# manually create expected directory in build directory
scripts_dir = join("build", "scripts-2.7")
if not os.path.exists(scripts_dir):
os.makedirs(scripts_dir)
hostpython = sh.Command(self.ctx.hostpython)
build_env = arch.get_env()
dest_dir = join(self.ctx.dist_dir, "root", "python")
pythonpath = join(dest_dir, 'lib', 'python2.7', 'site-packages')
build_env['PYTHONPATH'] = pythonpath
args = [hostpython, "setup.py", "install", "--prefix", dest_dir]
shprint(*args, _env=build_env)
args = [hostpython, "setup.py", "install"]
shprint(*args, _env=build_env)
2016-10-14 14:07:10 +02:00
recipe = CffiRecipe()