Skip to content

Commit

Permalink
Fix docs.rs build failures
Browse files Browse the repository at this point in the history
  • Loading branch information
staticintlucas committed Jan 6, 2024
1 parent 4486c43 commit 7e521e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion keyset-drawing/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ fn main() {
let ttx = ttx_dir.join(format!("{font}.ttx"));
let ttf = out_dir.join(format!("{font}.ttf"));

let contents = ttx_to_ttf(&ttx);
let contents = if std::env::var("DOCS_RS").is_ok() {
vec![] // We can't install fonttools/ttx in docs.rs's environment
} else {
ttx_to_ttf(&ttx)
};
fs::write(&ttf, contents)
.unwrap_or_else(|err| panic!("failed to write to {}: {err:?}", ttf.display()));

Expand All @@ -33,6 +37,7 @@ fn main() {

// Rerun if a different ttx is on PATH (e.g. one from a virtualenv)
println!("cargo:rerun-if-env-changed=PATH");
println!("cargo:rerun-if-env-changed=DOCS_RS");
}

fn ttx_to_ttf(path: impl AsRef<Path>) -> Vec<u8> {
Expand Down
6 changes: 5 additions & 1 deletion keyset-font/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ fn main() {
let ttx = ttx_dir.join(format!("{font}.ttx"));
let ttf = out_dir.join(format!("{font}.ttf"));

let contents = ttx_to_ttf(&ttx);
let contents = if std::env::var("DOCS_RS").is_ok() {
vec![] // We can't install fonttools/ttx in docs.rs's environment
} else {
ttx_to_ttf(&ttx)
};
fs::write(&ttf, contents)
.unwrap_or_else(|err| panic!("failed to write to {}: {err:?}", ttf.display()));

Expand Down

0 comments on commit 7e521e0

Please sign in to comment.