aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-12-12 16:18:43 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-12-12 16:18:43 -0800
commit29b4a936821393a185b14d717c4241c2e415277f (patch)
tree0cca654d979ea1b541fa5aff65971f86ea0b50d2
parent6c0eef73f7e7dc1a21a36e1ca6979f186dfa964e (diff)
parent2bc3334979ceaee2592e42b3135454ab63b4d009 (diff)
downloadcryptography-29b4a936821393a185b14d717c4241c2e415277f.tar.gz
cryptography-29b4a936821393a185b14d717c4241c2e415277f.tar.bz2
cryptography-29b4a936821393a185b14d717c4241c2e415277f.zip
Merge pull request #300 from dreid/supress-openssl-osx-deprecation-warnings
Supress the deprecation warnings by including an __APPLE__ only preamble.
-rw-r--r--cryptography/hazmat/bindings/openssl/backend.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/cryptography/hazmat/bindings/openssl/backend.py b/cryptography/hazmat/bindings/openssl/backend.py
index 6ab4dc26..f19c8cca 100644
--- a/cryptography/hazmat/bindings/openssl/backend.py
+++ b/cryptography/hazmat/bindings/openssl/backend.py
@@ -31,6 +31,24 @@ from cryptography.hazmat.primitives.ciphers.modes import (
CBC, CTR, ECB, OFB, CFB, GCM,
)
+_OSX_PRE_INCLUDE = """
+#ifdef __APPLE__
+#include <AvailabilityMacros.h>
+#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
+"""
+
@utils.register_interface(CipherBackend)
@utils.register_interface(HashBackend)
@@ -111,8 +129,15 @@ class Backend(object):
# is legal, but the following will fail to compile:
# int foo(int);
# int foo(short);
+
lib = ffi.verify(
- source="\n".join(includes + functions + customizations),
+ source="\n".join(
+ [_OSX_PRE_INCLUDE] +
+ includes +
+ [_OSX_POST_INCLUDE] +
+ functions +
+ customizations
+ ),
libraries=["crypto", "ssl"],
)