Skip to content

Commit 863e63f

Browse files
committed
fixes
1 parent 7dae1f6 commit 863e63f

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

crates/pet-mac-commandlinetools/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,17 @@ impl Locator for MacCmdLineTools {
106106
symlinks.sort();
107107
symlinks.dedup();
108108

109+
// Find other exes that are symlinks to the same exe in /Library/Developer/CommandLineTools/usr/bin
110+
for exe in find_executables("/Library/Developer/CommandLineTools/usr/bin") {
111+
if !symlinks.contains(&exe) {
112+
if let Some(symlink) = resolve_symlink(&exe) {
113+
if symlinks.contains(&symlink) {
114+
symlinks.push(exe);
115+
}
116+
}
117+
}
118+
}
119+
109120
if prefix.is_none() {
110121
// We would have identified the symlinks by now.
111122
// Look for the one with the path `/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9`

crates/pet/tests/ci_test.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,28 @@ fn verify_we_can_get_same_env_inf_using_from(environment: PythonEnvironment) {
305305
}
306306
// WIP.
307307
env.category = environment.category;
308+
309+
if let Some(prefix) = environment.clone().prefix {
310+
if env.clone().executable == Some(PathBuf::from("/usr/local/python/current/bin/python"))
311+
&& (prefix.to_str().unwrap() == "/usr/local/python/current"
312+
&& env.clone().prefix == Some(PathBuf::from("/usr/local/python/3.10.13")))
313+
|| (prefix.to_str().unwrap() == "/usr/local/python/3.10.13"
314+
&& env.clone().prefix == Some(PathBuf::from("/usr/local/python/current")))
315+
{
316+
// known issue https://github.com/microsoft/python-environment-tools/issues/64
317+
env.prefix = environment.clone().prefix;
318+
} else if env.clone().executable
319+
== Some(PathBuf::from("/home/codespace/.python/current/bin/python"))
320+
&& (prefix.to_str().unwrap() == "/home/codespace/.python/current"
321+
&& env.clone().prefix == Some(PathBuf::from("/usr/local/python/3.10.13")))
322+
|| (prefix.to_str().unwrap() == "/usr/local/python/3.10.13"
323+
&& env.clone().prefix == Some(PathBuf::from("/home/codespace/.python/current")))
324+
{
325+
// known issue https://github.com/microsoft/python-environment-tools/issues/64
326+
env.prefix = environment.clone().prefix;
327+
}
328+
}
329+
308330
assert_eq!(
309331
env, environment,
310332
"Environment mismatch for {:?}",

0 commit comments

Comments
 (0)