@@ -73,7 +73,13 @@ def install_parity(version_string):
73
73
uri , checksum = get_uri (** params )[0 ]
74
74
75
75
if not os .path .exists (path ):
76
- download_binary (path , uri , checksum )
76
+ try :
77
+ download_binary (path , uri , checksum )
78
+ except AssertionError as exc :
79
+ raise Exception ("failed to download binary at uri %r with params %r" % (
80
+ uri ,
81
+ params ,
82
+ )) from exc
77
83
78
84
return path
79
85
@@ -82,7 +88,7 @@ def download_binary(path, uri, checksum):
82
88
r = get_binary_stream (uri )
83
89
total_size = int (r .headers .get ('content-length' , 0 ))
84
90
os .makedirs (os .path .dirname (path ), exist_ok = True )
85
- digest = hashlib .md5 ()
91
+ digest = hashlib .sha256 ()
86
92
with open (path , 'wb' ) as f :
87
93
with tqdm (total = total_size ,
88
94
unit = 'B' ,
@@ -92,7 +98,8 @@ def download_binary(path, uri, checksum):
92
98
f .write (data )
93
99
pbar .update (len (data ))
94
100
digest .update (data )
95
- assert digest .hexdigest () == checksum
101
+ hex_digest = digest .hexdigest ()
102
+ assert hex_digest == checksum , "digest vs checksum: %r vs %r" % (hex_digest , checksum )
96
103
chmod_plus_x (path )
97
104
98
105
0 commit comments