From 5d00b8cc060b1dfce6fc7a578ee4922ba5785503 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Fri, 24 Jul 2026 12:06:28 -0700 Subject: [PATCH] fix: ignore Python install manager target files (Fixes #483) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- crates/pet-python-utils/src/executable.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/pet-python-utils/src/executable.rs b/crates/pet-python-utils/src/executable.rs index 6e8384a4..124a1fab 100644 --- a/crates/pet-python-utils/src/executable.rs +++ b/crates/pet-python-utils/src/executable.rs @@ -12,7 +12,7 @@ use std::{ lazy_static! { static ref WINDOWS_EXE: Regex = - Regex::new(r"python(\d+\.?)*.exe").expect("error parsing Windows executable regex"); + Regex::new(r"python(\d+\.?)*\.exe$").expect("error parsing Windows executable regex"); static ref UNIX_EXE: Regex = Regex::new(r"python(\d+\.?)*$").expect("error parsing Unix executable regex"); } @@ -342,6 +342,18 @@ mod tests { assert!(!is_python_executable_name( PathBuf::from("pythonw3.exe").as_path() )); + #[cfg(windows)] + assert!(!is_python_executable_name( + PathBuf::from("python.exe.__target__").as_path() + )); + #[cfg(windows)] + assert!(!is_python_executable_name( + PathBuf::from("python3.exe.__target__").as_path() + )); + #[cfg(windows)] + assert!(!is_python_executable_name( + PathBuf::from("python3.12.exe.__target__").as_path() + )); } #[test]