Skip to content
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
14 changes: 13 additions & 1 deletion crates/pet-python-utils/src/executable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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]
Expand Down
Loading