Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't watch PYTHON_SYS_EXECUTABLE and PATH when unnecessary #1231

Merged
merged 1 commit into from
Oct 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,17 +893,20 @@ fn main() -> Result<()> {
// TODO: Find out how we can set -undefined dynamic_lookup here (if this is possible)
}

let env_vars = [
"LD_LIBRARY_PATH",
"PATH",
"PYTHON_SYS_EXECUTABLE",
"PYO3_PYTHON",
"LIB",
];

for var in env_vars.iter() {
for var in ["LIB", "LD_LIBRARY_PATH", "PYO3_PYTHON"].iter() {
println!("cargo:rerun-if-env-changed={}", var);
}

if env::var_os("PYO3_PYTHON").is_none() {
// When PYO3_PYTHON is not used, PYTHON_SYS_EXECUTABLE has the highest priority.
// Let's watch it.
println!("cargo:rerun-if-env-changed=PYTHON_SYS_EXECUTABLE");
if env::var_os("PYTHON_SYS_EXECUTABLE").is_none() {
// When PYTHON_SYS_EXECUTABLE is also not used, then we use PATH.
// Let's watch this, too.
println!("cargo:rerun-if-env-changed=PATH");
}
}

Ok(())
}