8000 Merge pull request #718 from brussee/crypto-1.3.1 · peter11235/python-for-android@abad0e4 · GitHub
[go: up one dir, main page]

Skip to content

Commit abad0e4

Browse files
committed
Merge pull request kivy#718 from brussee/crypto-1.3.1
rewrite recipe and update cryptography to 1.3.1
2 parents 5289ab1 + 2f650fa commit abad0e4

File tree

3 files changed

+20
-115
lines changed

3 files changed

+20
-115
lines changed
Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,25 @@
1-
from os.path import dirname, join
2-
31
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
4-
2+
from os.path import dirname, join
53

64
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
4124

4225
recipe = CryptographyRecipe()

pythonforandroid/recipes/cryptography/fix-cffi-path.patch

Lines changed: 0 additions & 14 deletions
This file was deleted.

pythonforandroid/recipes/cryptography/link-static.patch

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0