summaryrefslogtreecommitdiffstats
path: root/source-builder/sb/download.py
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2014-08-04 18:09:30 +1000
committerChris Johns <chrisj@rtems.org>2014-08-04 18:09:30 +1000
commit910081d515bc7cd8ac8956da16ee2992a09ec360 (patch)
tree8066bbcaf94058ab0b10e776399949c9b6a1dd7c /source-builder/sb/download.py
parentrtems-4.11: Use gcc-4.9.1 for Microblaze. (diff)
downloadrtems-source-builder-910081d515bc7cd8ac8956da16ee2992a09ec360.tar.bz2
sb: Fix using hashlib's algorithms on python earlier than 2.7.
Diffstat (limited to 'source-builder/sb/download.py')
-rw-r--r--source-builder/sb/download.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index 51747b1..df448e0 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -58,7 +58,11 @@ def _hash_check(file_, absfile, macros, remove = True):
hash = hash.split()
if len(hash) != 2:
raise error.internal('invalid hash format: %s' % (file_))
- if hash[0] not in hashlib.algorithms:
+ try:
+ hashlib_algorithms = hashlib.algorithms
+ except:
+ hashlib_algorithms = ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512']
+ if hash[0] not in hashlib_algorithms:
raise error.general('invalid hash algorithm for %s: %s' % (file_, hash[0]))
hasher = None
_in = None