kivy-ios/recipes/cryptography/__init__.py

48 lines
1.7 KiB
Python
Raw Normal View History

2016-10-14 16:01:50 +02:00
from os.path import join
2016-10-14 14:07:10 +02:00
from toolchain import CythonRecipe
2016-11-02 14:34:21 +01:00
from toolchain import shprint
import os
2016-11-02 14:34:21 +01:00
import sh
2016-10-14 14:07:10 +02:00
class CryptographyRecipe(CythonRecipe):
name = "cryptography"
version = "1.5.2"
url = (
"https://pypi.python.org/packages/03/1a/"
"60984cb85cc38c4ebdfca27b32a6df6f1914959d8790f5a349608c78be61/"
"cryptography-{version}.tar.gz"
)
library = "libcryptography.a"
2016-10-14 17:59:39 +02:00
depends = ["host_setuptools", "cffi", "six", "idna", "pyasn1", "enum34"]
2016-10-14 14:07:10 +02:00
cythonize = False
2016-11-02 14:34:21 +01:00
def get_recipe_env(self, arch):
2016-11-02 17:43:23 +01:00
env = super(CryptographyRecipe, self).get_recipe_env(arch)
env["CC"] += " -I{}".format(
join(self.ctx.dist_dir, "include", arch.arch, "libffi"))
env["CFLAGS"] += " -I{}".format(
join(self.ctx.dist_dir, "include", arch.arch, "openssl", "openssl"))
2016-11-02 14:34:21 +01:00
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 = CryptographyRecipe()
2016-11-02 17:43:23 +01:00