diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-04-24 18:45:59 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-04-24 18:45:59 -0700 |
commit | deaafe752ca514cbf0e7e03a85b02c7cc9d50f1b (patch) | |
tree | d7251550203127cc75ea3e4b7a4c1c57c3e8f2b8 | |
parent | dd75a3fd330036a0fc8cfbd65b0f4bc2d9707597 (diff) | |
parent | 1f2cf3dac34eb719b83fbe6ce267a3a08369cd64 (diff) | |
download | cryptography-deaafe752ca514cbf0e7e03a85b02c7cc9d50f1b.tar.gz cryptography-deaafe752ca514cbf0e7e03a85b02c7cc9d50f1b.tar.bz2 cryptography-deaafe752ca514cbf0e7e03a85b02c7cc9d50f1b.zip |
Merge pull request #965 from reaperhulk/make-build-ffi-more-flexible
expand build_ffi helper function
-rw-r--r-- | cryptography/hazmat/bindings/commoncrypto/binding.py | 6 | ||||
-rw-r--r-- | cryptography/hazmat/bindings/openssl/binding.py | 10 | ||||
-rw-r--r-- | cryptography/hazmat/bindings/utils.py | 5 |
3 files changed, 15 insertions, 6 deletions
diff --git a/cryptography/hazmat/bindings/commoncrypto/binding.py b/cryptography/hazmat/bindings/commoncrypto/binding.py index 3673ea36..144bb099 100644 --- a/cryptography/hazmat/bindings/commoncrypto/binding.py +++ b/cryptography/hazmat/bindings/commoncrypto/binding.py @@ -42,8 +42,10 @@ class Binding(object): if cls.ffi is not None and cls.lib is not None: return - cls.ffi, cls.lib = build_ffi(cls._module_prefix, cls._modules, - "", "", []) + cls.ffi, cls.lib = build_ffi( + module_prefix=cls._module_prefix, + modules=cls._modules, + ) @classmethod def is_available(cls): diff --git a/cryptography/hazmat/bindings/openssl/binding.py b/cryptography/hazmat/bindings/openssl/binding.py index cc40a108..f0ff3275 100644 --- a/cryptography/hazmat/bindings/openssl/binding.py +++ b/cryptography/hazmat/bindings/openssl/binding.py @@ -97,9 +97,13 @@ class Binding(object): else: # pragma: no cover libraries = ["libeay32", "ssleay32", "advapi32"] - cls.ffi, cls.lib = build_ffi(cls._module_prefix, cls._modules, - _OSX_PRE_INCLUDE, _OSX_POST_INCLUDE, - libraries) + cls.ffi, cls.lib = build_ffi( + module_prefix=cls._module_prefix, + modules=cls._modules, + pre_include=_OSX_PRE_INCLUDE, + post_include=_OSX_POST_INCLUDE, + libraries=libraries, + ) res = cls.lib.Cryptography_add_osrandom_engine() assert res != 0 diff --git a/cryptography/hazmat/bindings/utils.py b/cryptography/hazmat/bindings/utils.py index 318b82bb..1c48116e 100644 --- a/cryptography/hazmat/bindings/utils.py +++ b/cryptography/hazmat/bindings/utils.py @@ -20,7 +20,8 @@ import sys import cffi -def build_ffi(module_prefix, modules, pre_include, post_include, libraries): +def build_ffi(module_prefix, modules, pre_include="", post_include="", + libraries=[], extra_compile_args=[], extra_link_args=[]): """ Modules listed in ``modules`` should have the following attributes: @@ -75,6 +76,8 @@ def build_ffi(module_prefix, modules, pre_include, post_include, libraries): modulename=_create_modulename(cdef_sources, source, sys.version), libraries=libraries, ext_package="cryptography", + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, ) for name in modules: |