Skip to content

Commit

Permalink
build: use runtime OUT_DIR
Browse files Browse the repository at this point in the history
This helps building on systems where they may be different (bazel, buck2, etc.)
  • Loading branch information
coffinmatician committed Apr 13, 2023
1 parent a0e285b commit ecc9b95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions newsfragments/3100.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use runtime OUT_DIR for pyo3-build-config
12 changes: 7 additions & 5 deletions pyo3-build-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,13 @@ const HOST_CONFIG: &str = include_str!(concat!(env!("OUT_DIR"), "/pyo3-build-con
#[doc(hidden)]
#[cfg(feature = "resolve-config")]
fn resolve_cross_compile_config_path() -> Option<PathBuf> {
env::var_os("TARGET").map(|target| {
let mut path = PathBuf::from(env!("OUT_DIR"));
path.push(Path::new(&target));
path.push("pyo3-build-config.txt");
path
env::var_os("TARGET").and_then(|target| {
std::env::var_os("OUT_DIR").map(|out_dir| {
let mut path = PathBuf::from(out_dir);
path.push(Path::new(&target));
path.push("pyo3-build-config.txt");
path
})
})
}

Expand Down

0 comments on commit ecc9b95

Please sign in to comment.