KWARC / rust-libxml

Rust wrapper for libxml2
https://crates.io/crates/libxml
MIT License
76 stars 38 forks source link

Display LIBXML2 env value on build errors. #122

Closed jcamiel closed 1 year ago

jcamiel commented 1 year ago

This PR add a (very small) improvement in case LIBXML2 env value is misconfigured. I've encountered this problem while porting Hurl to conda-forge where LIBXML2 value is set to "2.11".

Before the PR:

$ export LIBXML2="2.11"
$ cargo build
   Compiling libxml v0.3.3 (/Users/jc/Documents/Dev/rust-libxml)
error: failed to run custom build command for `libxml v0.3.3 (/Users/jc/Documents/Dev/rust-libxml)`

Caused by:
  process didn't exit successfully: `/Users/jc/Documents/Dev/rust-libxml/target/debug/build/libxml-5bb5ffa4b9ec77c1/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at build.rs:7:5:
  assertion failed: p.is_file()
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After the PR:

$ export LIBXML2="2.11"
   Compiling libxml v0.3.3 (/Users/jc/Documents/Dev/rust-libxml)
error: failed to run custom build command for `libxml v0.3.3 (/Users/jc/Documents/Dev/rust-libxml)`

Caused by:
  process didn't exit successfully: `/Users/jc/Documents/Dev/rust-libxml/target/debug/build/libxml-5bb5ffa4b9ec77c1/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at build.rs:10:5:
  not a file in LIBXML2 env (2.11)
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

In a nutshell assertion failed: p.is_file() vs not a file in LIBXML2 env (2.11)

(build.rs have been formatted with cargo fmt and lint with cargo clippy)

dginev commented 1 year ago

That sounds reasonable, thank you!