diff --git a/newsfragments/5745.fixed.md b/newsfragments/5745.fixed.md new file mode 100644 index 00000000000..9a67400d6de --- /dev/null +++ b/newsfragments/5745.fixed.md @@ -0,0 +1 @@ +Fix remote builds by not baking paths in the `pyo3-build-config` build scripts. diff --git a/pyo3-build-config/src/lib.rs b/pyo3-build-config/src/lib.rs index 5d8002d8c91..20f685cecdf 100644 --- a/pyo3-build-config/src/lib.rs +++ b/pyo3-build-config/src/lib.rs @@ -208,12 +208,10 @@ 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 { - 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 - }) + let mut path = PathBuf::from(env::var_os("OUT_DIR")?); + path.push(Path::new(&env::var_os("TARGET")?)); + path.push("pyo3-build-config.txt"); + Some(path) } /// Helper to print a feature cfg with a minimum rust version required.