|
1 | | -from os.path import dirname, join |
2 | | - |
3 | 1 | from pythonforandroid.recipe import CompiledComponentsPythonRecipe |
4 | | - |
| 2 | +from os.path import dirname, join |
5 | 3 |
|
6 | 4 | class CryptographyRecipe(CompiledComponentsPythonRecipe): |
7 | | - name = 'cryptography' |
8 | | - version = '1.2.3' |
9 | | - url = 'https://pypi.python.org/packages/source/c/cryptography/cryptography-{version}.tar.gz' |
10 | | - |
11 | | - depends = [('python2', 'python3crystax'), 'cffi', 'enum34', 'openssl', 'ipaddress', 'idna'] |
12 | | - |
13 | | - patches = ['fix-cffi-path.patch', |
14 | | - 'link-static.patch'] |
15 | | - |
16 | | - # call_hostpython_via_targetpython = False |
17 | | - |
18 | | - def get_recipe_env(self, arch=None): |
19 | | - env = super(CryptographyRecipe, self).get_recipe_env(arch) |
20 | | - # # libffi = self.get_recipe('libffi', self.ctx) |
21 | | - # # includes = libffi.get_include_dirs(arch) |
22 | | - # # env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes) |
23 | | - # # env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' + |
24 | | - # # self.ctx.get_libs_dir(arch.arch)) |
25 | | - openssl = self.get_recipe('openssl', self.ctx) |
26 | | - openssl_dir = openssl.get_build_dir(arch.arch) |
27 | | - env['CFLAGS'] = env.get('CFLAGS', '') + ' -I' + join(openssl_dir, 'include') |
28 | | - # env['LDFLAGS'] = env.get('LDFLAGS', '') + ' -L' + openssl.get_build_dir(arch.arch) |
29 | | - env['LIBSSL'] = join(openssl_dir, 'libssl.a') |
30 | | - env['LIBCRYPTO'] = join(openssl_dir, 'libcrypto.a') |
31 | | - env['PYTHONPATH'] = ':'.join([ |
32 | | - join(dirname(self.real_hostpython_location), 'Lib'), |
33 | | - join(dirname(self.real_hostpython_location), 'Lib', 'site-packages'), |
34 | | - env['BUILDLIB_PATH'], |
35 | | - ]) |
36 | | - return env |
37 | | - |
38 | | - def build_arch(self, arch): |
39 | | - super(CryptographyRecipe, self).build_arch(arch) |
40 | | - |
| 5 | + name = 'cryptography' |
| 6 | + version = '1.3.1' |
| 7 | + url = 'https://pypi.python.org/packages/source/c/cryptography/cryptography-{version}.tar.gz' |
| 8 | + depends = [('python2', 'python3crystax'), 'cffi', 'enum34', 'openssl', 'ipaddress', 'idna'] |
| 9 | + call_hostpython_via_targetpython = False |
| 10 | + |
| 11 | + def get_recipe_env(self, arch): |
| 12 | + env = super(CryptographyRecipe, self).get_recipe_env(arch) |
| 13 | + openssl_dir = self.get_recipe('openssl', self.ctx).get_build_dir(arch.arch) |
| 14 | + env['PYTHON_ROOT'] = self.ctx.get_python_install_dir() |
| 15 | + env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7' + \ |
| 16 | + ' -I' + join(openssl_dir, 'include') |
| 17 | + # Set linker to use the correct gcc |
| 18 | + env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions' |
| 19 | + env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + \ |
| 20 | + ' -L' + openssl_dir + \ |
| 21 | + ' -lpython2.7' + \ |
| 22 | + ' -lssl -lcrypto' |
| 23 | + return env |
41 | 24 |
|
42 | 25 | recipe = CryptographyRecipe() |
0 commit comments