From da5dca8a92dfe8e01c5f88c67fd78d37cd6a7d22 Mon Sep 17 00:00:00 2001 From: Terry Chia Date: Sun, 27 Jul 2014 12:27:52 +0800 Subject: Added entry_points. --- setup.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index f73394ee..30146b71 100644 --- a/setup.py +++ b/setup.py @@ -32,13 +32,15 @@ with open(os.path.join(base_dir, "cryptography", "__about__.py")) as f: exec(f.read(), about) +SETUPTOOLS_DEPENDENCY = "setuptools" CFFI_DEPENDENCY = "cffi>=0.8" SIX_DEPENDENCY = "six>=1.4.1" VECTORS_DEPENDENCY = "cryptography_vectors=={0}".format(about['__version__']) requirements = [ CFFI_DEPENDENCY, - SIX_DEPENDENCY + SIX_DEPENDENCY, + SETUPTOOLS_DEPENDENCY ] # If you add a new dep here you probably need to add it in the tox.ini as well @@ -173,5 +175,17 @@ setup( "build": CFFIBuild, "install": CFFIInstall, "test": PyTest, + }, + + entry_points={ + "cryptography.hazmat.backends": [ + "commoncrypto = cryptography.hazmat.backends.commoncrypto:backend", + "openssl = cryptography.hazmat.backends.openssl:backend" + ], + + "cryptography.hazmat.is_backend_available": [ + "commoncrypto = cryptography.hazmat.bindings.commoncrypto." + "binding:Binding.is_available" + ] } ) -- cgit v1.2.3 From 361545d874dce498461b5586cfdf45249c07ebbe Mon Sep 17 00:00:00 2001 From: Terry Chia Date: Mon, 28 Jul 2014 12:06:54 +0800 Subject: Removed need for Binding entry_point --- setup.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 30146b71..6a7642ff 100644 --- a/setup.py +++ b/setup.py @@ -14,6 +14,7 @@ from __future__ import absolute_import, division, print_function import os +import platform import subprocess import sys from distutils.command.build import build @@ -57,6 +58,21 @@ if not os.path.exists(os.path.join(base_dir, "vectors/setup.py")): test_requirements.append(VECTORS_DEPENDENCY) +def cc_is_available(): + return sys.platform == "darwin" and list(map( + int, platform.mac_ver()[0].split("."))) >= [10, 8, 0] + + +backends = [ + "openssl = cryptography.hazmat.backends.openssl:backend" +] + +if cc_is_available(): + backends.append( + "commoncrypto = cryptography.hazmat.backends.commoncrypto:backend", + ) + + def get_ext_modules(): from cryptography.hazmat.bindings.commoncrypto.binding import ( Binding as CommonCryptoBinding @@ -71,7 +87,7 @@ def get_ext_modules(): constant_time._ffi.verifier.get_extension(), padding._ffi.verifier.get_extension() ] - if CommonCryptoBinding.is_available(): + if cc_is_available(): ext_modules.append(CommonCryptoBinding().ffi.verifier.get_extension()) return ext_modules @@ -178,14 +194,6 @@ setup( }, entry_points={ - "cryptography.hazmat.backends": [ - "commoncrypto = cryptography.hazmat.backends.commoncrypto:backend", - "openssl = cryptography.hazmat.backends.openssl:backend" - ], - - "cryptography.hazmat.is_backend_available": [ - "commoncrypto = cryptography.hazmat.bindings.commoncrypto." - "binding:Binding.is_available" - ] + "cryptography.backends": backends, } ) -- cgit v1.2.3