Skip to content

Commit 1ef6f7c

Browse files
author
Ioannis Giagkiozis
committed
remove lfs
remove kaleido from repo build script for plotly_kaleido to fetch the released kaleido binaries
1 parent a83cdde commit 1ef6f7c

File tree

164 files changed

+107
-14738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+107
-14738
lines changed

.gitattributes

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
plotly_kaleido/kaleido/windows/bin/kaleido.exe filter=lfs diff=lfs merge=lfs -text
2-
plotly_kaleido/kaleido/linux/bin/kaleido filter=lfs diff=lfs merge=lfs -text
3-
plotly_kaleido/kaleido/macos/bin/kaleido filter=lfs diff=lfs merge=lfs -text

plotly/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ askama = "0.9.0"
3232
rand = "0.7.3"
3333
rand_distr = "0.2.2"
3434
num = "0.2.1"
35-
#chrono = { version = "0.4.11", features = ["serde"] }
3635
csv = "1.1.3"
3736

3837
[dev-dependencies]

plotly_kaleido/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
examples/downloader.rs
2+
kaleido/*

plotly_kaleido/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ exclude = [
1919
[dependencies]
2020
serde = { version = "1.0", features = ["derive"] }
2121
serde_json = "1.0"
22-
base64 = "0.12.3"
22+
base64 = "0.12.3"
23+
24+
25+
[build-dependencies]
26+
zip = "0.5.6"

plotly_kaleido/build.rs

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
extern crate zip;
2+
use std::fs::File;
3+
use std::str::FromStr;
4+
use std::io::Result;
5+
use std::env;
6+
7+
use std::io::BufReader;
8+
use std::path::{Path, PathBuf};
9+
use std::process::{Command, Stdio};
10+
11+
use std::fs;
12+
use std::io;
13+
14+
#[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";
16+
#[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";
18+
#[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";
20+
21+
22+
fn extract_zip(p: &PathBuf, zip_file: &PathBuf) -> Result<()> {
23+
let file = fs::File::open(&zip_file).unwrap();
24+
let mut archive = zip::ZipArchive::new(file).unwrap();
25+
26+
for i in 0..archive.len() {
27+
let mut file = archive.by_index(i).unwrap();
28+
let outpath = file.sanitized_name();
29+
let outpath = p.join(outpath);
30+
println!("outpath: {:?}", outpath);
31+
32+
{
33+
let comment = file.comment();
34+
if !comment.is_empty() {
35+
println!("File {} comment: {}", i, comment);
36+
}
37+
}
38+
39+
if (&*file.name()).ends_with('/') {
40+
println!(
41+
"File {} extracted to \"{}\"",
42+
i,
43+
outpath.as_path().display()
44+
);
45+
fs::create_dir_all(&outpath).unwrap();
46+
} else {
47+
println!(
48+
"File {} extracted to \"{}\" ({} bytes)",
49+
i,
50+
outpath.as_path().display(),
51+
file.size()
52+
);
53+
if let Some(p) = outpath.parent() {
54+
if !p.exists() {
55+
fs::create_dir_all(&p).unwrap();
56+
}
57+
}
58+
let mut outfile = fs::File::create(&outpath).unwrap();
59+
io::copy(&mut file, &mut outfile).unwrap();
60+
}
61+
62+
// Get and Set permissions
63+
#[cfg(unix)]
64+
{
65+
use std::os::unix::fs::PermissionsExt;
66+
67+
if let Some(mode) = file.unix_mode() {
68+
fs::set_permissions(&outpath, fs::Permissions::from_mode(mode)).unwrap();
69+
}
70+
}
71+
}
72+
73+
fs::remove_file(zip_file);
74+
Ok(())
75+
}
76+
77+
78+
fn main() -> Result<()> {
79+
let mut p = PathBuf::from(env::var("OUT_DIR").unwrap());
80+
let mut dst = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
81+
dst = dst.parent().unwrap().to_path_buf();
82+
dst = dst.join("plotly_kaleido");
83+
84+
85+
let mut kaleido_zip_file = p.join("kaleido.zip");
86+
87+
let mut cmd = Command::new("cargo")
88+
.args(&["install", "ruget"]).spawn().unwrap();
89+
cmd.wait();
90+
91+
let mut cmd = Command::new("ruget")
92+
.args(&[KALEIDO_URL, "-o", kaleido_zip_file.as_path().to_str().unwrap()])
93+
.spawn().unwrap();
94+
cmd.wait();
95+
96+
extract_zip(&dst, &kaleido_zip_file)?;
97+
Ok(())
98+
}

plotly_kaleido/kaleido/linux/LICENSE.txt

Lines changed: 0 additions & 59 deletions
This file was deleted.

plotly_kaleido/kaleido/linux/bin/kaleido

Lines changed: 0 additions & 3 deletions
This file was deleted.
Binary file not shown.

plotly_kaleido/kaleido/linux/bin/swiftshader/libEGL.so.TOC

Lines changed: 0 additions & 140 deletions
This file was deleted.
Binary file not shown.

0 commit comments

Comments
 (0)