Skip to content

Commit df7eddd

Browse files
author
Ioannis Giagkiozis
committed
build script cleanup - windows ok
1 parent 1ef6f7c commit df7eddd

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

plotly_kaleido/build.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
extern crate zip;
2-
use std::fs::File;
3-
use std::str::FromStr;
42
use std::io::Result;
53
use std::env;
6-
7-
use std::io::BufReader;
8-
use std::path::{Path, PathBuf};
9-
use std::process::{Command, Stdio};
4+
use std::path::PathBuf;
5+
use std::process::Command;
106

117
use std::fs;
128
use std::io;
139

1410
#[cfg(target_os = "linux")]
15-
const KALEIDO_URL: &'static str = "https://github.com/plotly/Kaleido/releases/download/v0.0.1rc9/kaleido_linux-0.0.1rc9.zip";
11+
const KALEIDO_URL: &str = "https://github.com/plotly/Kaleido/releases/download/v0.0.1rc9/kaleido_linux-0.0.1rc9.zip";
1612
#[cfg(target_os = "windows")]
17-
const KALEIDO_URL: &'static str= "https://github.com/plotly/Kaleido/releases/download/v0.0.1rc9/kaleido_win-0.0.1rc9.zip";
13+
const KALEIDO_URL: &str= "https://github.com/plotly/Kaleido/releases/download/v0.0.1rc9/kaleido_win-0.0.1rc9.zip";
1814
#[cfg(target_os = "macos")]
19-
const KALEIDO_URL: &'static str = "https://github.com/plotly/Kaleido/releases/download/v0.0.1rc9/kaleido_mac-0.0.1rc9.zip";
15+
const KALEIDO_URL: &str = "https://github.com/plotly/Kaleido/releases/download/v0.0.1rc9/kaleido_mac-0.0.1rc9.zip";
2016

2117

2218
fn extract_zip(p: &PathBuf, zip_file: &PathBuf) -> Result<()> {
@@ -70,28 +66,28 @@ fn extract_zip(p: &PathBuf, zip_file: &PathBuf) -> Result<()> {
7066
}
7167
}
7268

73-
fs::remove_file(zip_file);
69+
fs::remove_file(zip_file)?;
7470
Ok(())
7571
}
7672

7773

7874
fn main() -> Result<()> {
79-
let mut p = PathBuf::from(env::var("OUT_DIR").unwrap());
75+
let p = PathBuf::from(env::var("OUT_DIR").unwrap());
8076
let mut dst = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
8177
dst = dst.parent().unwrap().to_path_buf();
8278
dst = dst.join("plotly_kaleido");
8379

8480

85-
let mut kaleido_zip_file = p.join("kaleido.zip");
81+
let kaleido_zip_file = p.join("kaleido.zip");
8682

8783
let mut cmd = Command::new("cargo")
8884
.args(&["install", "ruget"]).spawn().unwrap();
89-
cmd.wait();
85+
cmd.wait()?;
9086

9187
let mut cmd = Command::new("ruget")
9288
.args(&[KALEIDO_URL, "-o", kaleido_zip_file.as_path().to_str().unwrap()])
9389
.spawn().unwrap();
94-
cmd.wait();
90+
cmd.wait()?;
9591

9692
extract_zip(&dst, &kaleido_zip_file)?;
9793
Ok(())

plotly_kaleido/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ impl Kaleido {
187187
#[cfg(test)]
188188
mod tests {
189189
use super::*;
190-
use std::env;
191-
use std::path::{Path, PathBuf};
190+
use std::path::PathBuf;
192191

193192
const TEST_PLOT: &str = r#"{
194193
"data": [{"type":"scatter","x":[1,2,3,4],"y":[10,15,13,17],"name":"trace1","mode":"markers"},

0 commit comments

Comments
 (0)