Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions newsfragments/6008.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`pyo3-ffi` will now rebuild when the Python virtual environment changes in-place.
10 changes: 8 additions & 2 deletions pyo3-build-config/src/impl_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1818,10 +1818,16 @@ where
}

fn venv_interpreter(virtual_env: &OsStr, windows: bool) -> PathBuf {
let venv = Path::new(virtual_env);
// Rebuild if the virtual environment configuration changes
println!(
"cargo:rerun-if-changed={}",
venv.join("pyvenv.cfg").display()
);
if windows {
Path::new(virtual_env).join("Scripts").join("python.exe")
venv.join("Scripts").join("python.exe")
} else {
Path::new(virtual_env).join("bin").join("python")
venv.join("bin").join("python")
}
}

Expand Down
Loading