make cffi recipe work, additionally install pycparser in hostpython

This commit is contained in:
Robert Niederreiter 2016-11-04 12:48:30 +01:00
parent 1eed3853d5
commit b392c61ae5
2 changed files with 23 additions and 0 deletions

View file

@ -1,5 +1,8 @@
from os.path import join
from toolchain import CythonRecipe
from toolchain import shprint
import os
import sh
class CffiRecipe(CythonRecipe):
@ -19,4 +22,22 @@ class CffiRecipe(CythonRecipe):
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)
recipe = CffiRecipe()

View file

@ -29,5 +29,7 @@ class PycparserRecipe(PythonRecipe):
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)
recipe = PycparserRecipe()