File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ exclude = ["mkl_lib/mkl.tar.xz"]
18
18
[build-dependencies ]
19
19
pkg-config = " 0.3"
20
20
failure = " 0.1"
21
- reqwest = " 0.9"
22
21
xz2 = " 0.1"
23
22
tar = " 0.4"
23
+ curl = " 0.4"
24
24
25
25
[dev-dependencies ]
26
26
libc = " 0.2"
Original file line number Diff line number Diff line change 20
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
// SOFTWARE.
22
22
23
+ use curl:: easy:: Easy ;
23
24
use failure:: * ;
24
- use std:: { env, fs, io, path:: * } ;
25
+ use std:: {
26
+ env, fs,
27
+ io:: { self , Write } ,
28
+ path:: * ,
29
+ } ;
25
30
26
31
const S3_ADDR : & ' static str = "https://s3-ap-northeast-1.amazonaws.com/rust-intel-mkl" ;
27
32
@@ -57,13 +62,12 @@ fn main() -> Fallible<()> {
57
62
let archive = out_dir. join ( mkl:: ARCHIVE ) ;
58
63
if !archive. exists ( ) {
59
64
eprintln ! ( "Download archive from AWS S3: {}/{}" , S3_ADDR , mkl:: ARCHIVE ) ;
60
- let mut res = reqwest:: get ( & format ! ( "{}/{}" , S3_ADDR , mkl:: ARCHIVE ) ) ?;
61
- if !res. status ( ) . is_success ( ) {
62
- bail ! ( "HTTP access failed: {}" , res. status( ) ) ;
63
- }
64
65
let f = fs:: File :: create ( & archive) ?;
65
66
let mut buf = io:: BufWriter :: new ( f) ;
66
- res. copy_to ( & mut buf) ?;
67
+ let mut easy = Easy :: new ( ) ;
68
+ easy. url ( & format ! ( "{}/{}" , S3_ADDR , mkl:: ARCHIVE ) ) ?;
69
+ easy. write_function ( move |data| Ok ( buf. write ( data) . unwrap ( ) ) ) ?;
70
+ easy. perform ( ) ?;
67
71
assert ! ( archive. exists( ) ) ;
68
72
} else {
69
73
eprintln ! ( "Use existing archive" ) ;
You can’t perform that action at this time.
0 commit comments