Skip to content

Commit

Permalink
Merge pull request #24 from scipopt/update-scip
Browse files Browse the repository at this point in the history
Update to scip 9.2
  • Loading branch information
mmghannam authored Dec 30, 2024
2 parents c78bc3a + f9efd47 commit 2432067
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "scip-sys"
version = "0.1.16"
version = "0.1.17"
edition = "2021"
description = "Bindings for the C SCIP solver."
repository = "https://github.com/scipopt/scip-sys"
Expand Down
2 changes: 1 addition & 1 deletion bundled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn download_scip() {
};

let url = format!(
"https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.5.0/libscip-{os_string}.zip"
"https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.6.1/libscip-{os_string}.zip"
);

download_and_extract_zip(&url, &extract_path)
Expand Down
17 changes: 14 additions & 3 deletions download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ pub fn download_and_extract_zip(url: &str, extract_path: &Path) -> Result<(), Bo

// Create a temporary file to store the ZIP
let dir = tempdir()?;
let zip_path = dir.path().join("scip.zip");


let zip_path = dir.path().join("libscip.zip");

let mut temp_file = File::create(&zip_path)?;
temp_file.write_all(&content)?;
Expand All @@ -33,5 +31,18 @@ pub fn download_and_extract_zip(url: &str, extract_path: &Path) -> Result<(), Bo
std::fs::read(zip_path).unwrap(),
), &target_dir, false)?;

// Check if the extracted content is another zip file
let extracted_files: Vec<_> = std::fs::read_dir(&target_dir)?.collect();
if extracted_files.len() == 1 {
let first_file = extracted_files[0].as_ref().unwrap();
if first_file.path().extension().map_or(false, |ext| ext == "zip") {
println!("cargo:warning=Found nested zip file, extracting again");
let nested_zip_path = first_file.path();
extract(Cursor::new(
std::fs::read(&nested_zip_path).unwrap(),
), &(target_dir.join("scip_install")), true)?;
std::fs::remove_file(nested_zip_path)?;
}
}
Ok(())
}

0 comments on commit 2432067

Please sign in to comment.