forked from pool/python-cryptography
- Properly invoke testsuite, therefore add dependencies on iso8601 and pretend - Only use pkg-config for libffi on newer distros, stay with old-style devel package requires to fix SLE build OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cryptography?expand=0&rev=2
81 lines
2.4 KiB
Diff
81 lines
2.4 KiB
Diff
--- a/setup.py 2014-02-22 22:35:18.000000000 +0100
|
|
+++ b/setup.py 2014-03-31 18:02:28.144820932 +0200
|
|
@@ -12,6 +12,7 @@
|
|
# limitations under the License.
|
|
import os
|
|
from distutils.command.build import build
|
|
+from distutils.command.install import install
|
|
|
|
from setuptools import setup, find_packages
|
|
|
|
@@ -32,6 +33,27 @@
|
|
]
|
|
|
|
|
|
+def get_ext_modules():
|
|
+ from cryptography.hazmat.bindings.commoncrypto.binding import (
|
|
+ Binding as CommonCryptoBinding
|
|
+ )
|
|
+ from cryptography.hazmat.bindings.openssl.binding import (
|
|
+ Binding as OpenSSLBinding
|
|
+ )
|
|
+ from cryptography.hazmat.primitives import constant_time, padding
|
|
+
|
|
+ ext_modules = [
|
|
+ OpenSSLBinding().ffi.verifier.get_extension(),
|
|
+ constant_time._ffi.verifier.get_extension(),
|
|
+ padding._ffi.verifier.get_extension()
|
|
+ ]
|
|
+ if CommonCryptoBinding.is_available():
|
|
+ ext_modules.append(
|
|
+ CommonCryptoBinding().ffi.verifier.get_extension()
|
|
+ )
|
|
+ return ext_modules
|
|
+
|
|
+
|
|
class cffi_build(build):
|
|
"""
|
|
This class exists, instead of just providing ``ext_modules=[...]`` directly
|
|
@@ -43,25 +65,17 @@
|
|
"""
|
|
|
|
def finalize_options(self):
|
|
- from cryptography.hazmat.bindings.commoncrypto.binding import (
|
|
- Binding as CommonCryptoBinding
|
|
- )
|
|
- from cryptography.hazmat.bindings.openssl.binding import (
|
|
- Binding as OpenSSLBinding
|
|
- )
|
|
- from cryptography.hazmat.primitives import constant_time, padding
|
|
+ self.distribution.ext_modules = get_ext_modules()
|
|
+ build.finalize_options(self)
|
|
|
|
- self.distribution.ext_modules = [
|
|
- OpenSSLBinding().ffi.verifier.get_extension(),
|
|
- constant_time._ffi.verifier.get_extension(),
|
|
- padding._ffi.verifier.get_extension()
|
|
- ]
|
|
- if CommonCryptoBinding.is_available():
|
|
- self.distribution.ext_modules.append(
|
|
- CommonCryptoBinding().ffi.verifier.get_extension()
|
|
- )
|
|
|
|
- build.finalize_options(self)
|
|
+class cffi_install(install):
|
|
+ """
|
|
+ As a consequence...
|
|
+ """
|
|
+ def finalize_options(self):
|
|
+ self.distribution.ext_modules = get_ext_modules()
|
|
+ install.finalize_options(self)
|
|
|
|
|
|
with open(os.path.join(base_dir, "README.rst")) as f:
|
|
@@ -111,5 +125,6 @@
|
|
ext_package="cryptography",
|
|
cmdclass={
|
|
"build": cffi_build,
|
|
+ "install": cffi_install
|
|
}
|
|
)
|