File tree 3 files changed +19
-5
lines changed
3 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ before_script:
76
76
- if [ -n "$GETH_VERSION" ] && [ ! -e "$GETH_BINARY" ]; then python -m geth.install $GETH_VERSION; fi
77
77
- if [ -n "$GETH_VERSION" ]; then $GETH_BINARY version; fi
78
78
- if [ -n "$GETH_VERSION" ]; then $GETH_BINARY makedag 0 $HOME/.ethash; fi
79
+ - if [ -n "$PARITY_VERSION" ]; then python tests/integration/install_parity.py $PARITY_VERSION; fi
79
80
- pip freeze
80
81
script :
81
82
- tox $TOX_POSARGS
Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ pytest-pythonpath>=0.3
8
8
pytest-watch == 4.*
9
9
pytest-xdist == 1.*
10
10
tox >= 1.8.0
11
+ tqdm
11
12
when-changed
Original file line number Diff line number Diff line change 1
1
import hashlib
2
2
import os
3
+ import sys
3
4
import stat
5
+ from tqdm import tqdm
4
6
5
7
from eth_utils import (
6
8
to_tuple ,
@@ -66,13 +68,19 @@ def install_parity(version_string):
66
68
67
69
68
70
def download_binary (path , uri , checksum ):
69
- bin_stream = get_binary_stream (uri )
71
+ r = get_binary_stream (uri )
72
+ total_size = int (r .headers .get ('content-length' , 0 ));
70
73
os .makedirs (os .path .dirname (path ), exist_ok = True )
71
74
digest = hashlib .md5 ()
72
75
with open (path , 'wb' ) as f :
73
- for chunk in bin_stream :
74
- f .write (chunk )
75
- digest .update (chunk )
76
+ with tqdm (total = total_size ,
77
+ unit = 'B' ,
78
+ unit_scale = True ,
79
+ unit_divisor = 1024 ) as pbar :
80
+ for data in r .iter_content (32 * 1024 ):
81
+ f .write (data );
82
+ pbar .update (len (data ))
83
+ digest .update (data )
76
84
assert digest .hexdigest () == checksum
77
85
chmod_plus_x (path )
78
86
@@ -85,6 +93,10 @@ def chmod_plus_x(executable_path):
85
93
def get_binary_stream (uri ):
86
94
resp = requests .get (uri , stream = True )
87
95
if resp .status_code == 200 :
88
- return resp . raw
96
+ return resp
89
97
else :
90
98
resp .raise_for_status ()
99
+
100
+
101
+ if __name__ == '__main__' :
102
+ install_parity (sys .argv [1 ])
You can’t perform that action at this time.
0 commit comments