summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorDwayne C. Litzenberger <dlitz@dlitz.net>2011-10-10 15:36:02 -0400
committerDwayne C. Litzenberger <dlitz@dlitz.net>2011-10-10 16:05:23 -0400
commitc90c797a58f455765dbf5745690d6a0f91e2b145 (patch)
treec05679b212a15caca7b56708866f86c5eaa00173 /setup.py
parent75915871a3187354b69d4db411cffaa1955eec42 (diff)
downloadpycrypto-c90c797a58f455765dbf5745690d6a0f91e2b145.tar.gz
Don't test SHA224/384/512 where hashlib isn't available (Python < 2.5)
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index 91478cb..3a8abfc 100644
--- a/setup.py
+++ b/setup.py
@@ -84,6 +84,14 @@ else:
if sys.platform != "win32": # Avoid nt.py, as 2to3 can't fix it w/o winrandom
EXCLUDE_PY += [('Crypto.Random.OSRNG','nt')]
+# Exclude SHA224/384/512 if they're not present (Python < 2.5)
+try: from hashlib import sha224
+except ImportError: EXCLUDE_PY += [('Crypto.Hash', 'SHA224')]
+try: from hashlib import sha384
+except ImportError: EXCLUDE_PY += [('Crypto.Hash', 'SHA384')]
+try: from hashlib import sha512
+except ImportError: EXCLUDE_PY += [('Crypto.Hash', 'SHA512')]
+
# Work around the print / print() issue with Python 2.x and 3.x. We only need
# to print at one point of the code, which makes this easy