Skip to content

Commit

Permalink
Merge pull request #17 from jacobsvante/main
Browse files Browse the repository at this point in the history
 fix: Increase build time downloads timeout to 300s
  • Loading branch information
mmghannam committed Apr 2, 2024
2 parents 976778d + aade750 commit 6094735
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ license = "Apache-2.0"
links = "scip"

[features]
bundled = ["reqwest", "zip", "tempfile", "zip-extract"]
from-source = ["reqwest", "zip", "tempfile", "zip-extract", "cmake"]
bundled = ["ureq", "zip", "tempfile", "zip-extract"]
from-source = ["ureq", "zip", "tempfile", "zip-extract", "cmake"]

[build-dependencies]
bindgen = "0.64"
cc = "1.0.73"
glob = "0.3.1"
reqwest = { version = "0.11", features = ["blocking", "json"], optional = true }
ureq = { version = "2.9.6", optional = true }
zip = { version = "0.5", optional = true }
tempfile = { version = "3.2", optional = true }
zip-extract = { version = "0.1.3", optional = true }
Expand Down
7 changes: 5 additions & 2 deletions download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ use std::error::Error;
use tempfile::tempdir;
use std::fs::File;
use std::io::Cursor;
use std::io::Read;
use std::io::Write;
use std::path::Path;
use std::path::PathBuf;
use std::time::Duration;
use zip_extract::extract;


pub fn download_and_extract_zip(url: &str, extract_path: &Path) -> Result<(), Box<dyn Error>> {
// Download the ZIP file
println!("cargo:warning=Downloading from {}", url);
let response = reqwest::blocking::Client::new().get(url).send()?;
let content = response.bytes()?;
let resp = ureq::get(url).timeout(Duration::from_secs(300)).call()?;
let mut content: Vec<u8> = Vec::new();
resp.into_reader().read_to_end(&mut content)?;

// Create a temporary file to store the ZIP
let dir = tempdir()?;
Expand Down

0 comments on commit 6094735

Please sign in to comment.