diff --git a/pythonforandroid/recipes/cryptography/__init__.py b/pythonforandroid/recipes/cryptography/__init__.py index c41b798768..3ce8ba8cdf 100644 --- a/pythonforandroid/recipes/cryptography/__init__.py +++ b/pythonforandroid/recipes/cryptography/__init__.py @@ -1,42 +1,25 @@ -from os.path import dirname, join - from pythonforandroid.recipe import CompiledComponentsPythonRecipe - +from os.path import dirname, join class CryptographyRecipe(CompiledComponentsPythonRecipe): - name = 'cryptography' - version = '1.2.3' - url = 'https://pypi.python.org/packages/source/c/cryptography/cryptography-{version}.tar.gz' - - depends = [('python2', 'python3crystax'), 'cffi', 'enum34', 'openssl', 'ipaddress', 'idna'] - - patches = ['fix-cffi-path.patch', - 'link-static.patch'] - - # call_hostpython_via_targetpython = False - - def get_recipe_env(self, arch=None): - env = super(CryptographyRecipe, self).get_recipe_env(arch) - # # libffi = self.get_recipe('libffi', self.ctx) - # # includes = libffi.get_include_dirs(arch) - # # env['CFLAGS'] = ' -I'.join([env.get('CFLAGS', '')] + includes) - # # env['LDFLAGS'] = (env.get('CFLAGS', '') + ' -L' + - # # self.ctx.get_libs_dir(arch.arch)) - openssl = self.get_recipe('openssl', self.ctx) - openssl_dir = openssl.get_build_dir(arch.arch) - env['CFLAGS'] = env.get('CFLAGS', '') + ' -I' + join(openssl_dir, 'include') - # env['LDFLAGS'] = env.get('LDFLAGS', '') + ' -L' + openssl.get_build_dir(arch.arch) - env['LIBSSL'] = join(openssl_dir, 'libssl.a') - env['LIBCRYPTO'] = join(openssl_dir, 'libcrypto.a') - env['PYTHONPATH'] = ':'.join([ - join(dirname(self.real_hostpython_location), 'Lib'), - join(dirname(self.real_hostpython_location), 'Lib', 'site-packages'), - env['BUILDLIB_PATH'], - ]) - return env - - def build_arch(self, arch): - super(CryptographyRecipe, self).build_arch(arch) - + name = 'cryptography' + version = '1.3.1' + url = 'https://pypi.python.org/packages/source/c/cryptography/cryptography-{version}.tar.gz' + depends = [('python2', 'python3crystax'), 'cffi', 'enum34', 'openssl', 'ipaddress', 'idna'] + call_hostpython_via_targetpython = False + + def get_recipe_env(self, arch): + env = super(CryptographyRecipe, self).get_recipe_env(arch) + openssl_dir = self.get_recipe('openssl', self.ctx).get_build_dir(arch.arch) + env['PYTHON_ROOT'] = self.ctx.get_python_install_dir() + env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7' + \ + ' -I' + join(openssl_dir, 'include') + # Set linker to use the correct gcc + env['LDSHARED'] = env['CC'] + ' -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions' + env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + \ + ' -L' + openssl_dir + \ + ' -lpython2.7' + \ + ' -lssl -lcrypto' + return env recipe = CryptographyRecipe() diff --git a/pythonforandroid/recipes/cryptography/fix-cffi-path.patch b/pythonforandroid/recipes/cryptography/fix-cffi-path.patch deleted file mode 100644 index 54489df65d..0000000000 --- a/pythonforandroid/recipes/cryptography/fix-cffi-path.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -Naur cryptography/setup.py b/setup.py ---- cryptography/setup.py 2015-12-10 13:53:28.000000000 -0600 -+++ b/setup.py 2015-12-23 12:12:22.830287138 -0600 -@@ -18,6 +18,10 @@ - from setuptools.command.install import install - from setuptools.command.test import test - -+import sys -+for d in sys.path[:]: -+ if 'python-installs' in d: -+ sys.path.remove(d) - - base_dir = os.path.dirname(__file__) - src_dir = os.path.join(base_dir, "src") diff --git a/pythonforandroid/recipes/cryptography/link-static.patch b/pythonforandroid/recipes/cryptography/link-static.patch deleted file mode 100644 index 4784baf585..0000000000 --- a/pythonforandroid/recipes/cryptography/link-static.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- cryptography/src/_cffi_src/build_openssl.py 2016-03-07 17:20:59.771109661 -0600 -+++ b/src/_cffi_src/build_openssl.py 2016-03-07 17:22:00.167111227 -0600 -@@ -12,50 +12,6 @@ - ) - - --def _get_openssl_libraries(platform): -- # OpenSSL goes by a different library name on different operating systems. -- if platform == "darwin": -- return _osx_libraries( -- os.environ.get("CRYPTOGRAPHY_OSX_NO_LINK_FLAGS") -- ) -- elif platform == "win32": -- return ["libeay32", "ssleay32", "advapi32", -- "crypt32", "gdi32", "user32", "ws2_32"] -- else: -- # In some circumstances, the order in which these libs are -- # specified on the linker command-line is significant; -- # libssl must come before libcrypto -- # (http://marc.info/?l=openssl-users&m=135361825921871) -- return ["ssl", "crypto"] -- -- --def _osx_libraries(build_static): -- # For building statically we don't want to pass the -lssl or -lcrypto flags -- if build_static == "1": -- return [] -- else: -- return ["ssl", "crypto"] -- -- --_OSX_PRE_INCLUDE = """ --#ifdef __APPLE__ --#include --#define __ORIG_DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER \ -- DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER --#undef DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER --#define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER --#endif --""" -- --_OSX_POST_INCLUDE = """ --#ifdef __APPLE__ --#undef DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER --#define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER \ -- __ORIG_DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER --#endif --""" -- -- - ffi = build_ffi_for_binding( - module_name="_openssl", - module_prefix="_cffi_src.openssl.", -@@ -92,8 +48,6 @@ - "pkcs7", - "callbacks", - ], -- pre_include=_OSX_PRE_INCLUDE, -- post_include=_OSX_POST_INCLUDE, -- libraries=_get_openssl_libraries(sys.platform), -- extra_link_args=extra_link_args(compiler_type()), -+ libraries=[], -+ extra_link_args=[os.environ['LIBSSL'], os.environ['LIBCRYPTO']], - )