Skip to content

Commit

Permalink
Fixes indentation and panic on unsupported OS while using bundled bin…
Browse files Browse the repository at this point in the history
…dings.
  • Loading branch information
3c7 committed Jan 4, 2024
1 parent 90174f2 commit e1ac71c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
pip install maturin pytest
maturin develop
pytest tests
build-macos:
build-macos:
runs-on: macos-latest
steps:
- name: Checkout sources
Expand All @@ -63,4 +63,4 @@ build-macos:
- name: Run Rust tests with bundled bindings
run: cargo clean && YARI_USE_BUNDLED_BINDINGS=1 CFLAGS="-I$(brew --prefix)/include" LDFLAGS="-L$(brew --prefix)/lib $LDFLAGS" LIBRARY_PATH="$(brew --prefix)/lib:$LIBRARY_PATH" cargo test --verbose
- name: Run Python tests
run: cd yari-py && .venv/bin/maturin develop && .venv/bin/pytest
run: cd yari-py && .venv/bin/maturin develop && .venv/bin/pytest
12 changes: 7 additions & 5 deletions yari-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,13 @@ fn main() {
let out_path = PathBuf::from(out_dir).join("bindings.rs");
if use_bundled_bindings.is_some() {
// Different bindings for linux and macos
#[cfg(target_os = "linux")]
let binding_file = "bindings-linux.rs";
#[cfg(target_os = "macos")]
let binding_file = "bindings-macos.rs";

let binding_file = if cfg!(target_os = "linux") {
"bindings-linux.rs"
} else if cfg!(target_os = "macos") {
"bindings-macos.rs"
} else {
panic!("Unsupported OS for bundled bindings.")
};
fs::copy(PathBuf::from("bindings").join(binding_file), out_path)
.expect("Could not copy bindings to output directory");
} else if let Some(bindings_file) = option_env!("YARI_BINDINGS_FILE") {
Expand Down

0 comments on commit e1ac71c

Please sign in to comment.