diff --git a/native_locator/src/common_python.rs b/native_locator/src/common_python.rs index f1a1bdb1d430..a83afaa2bc84 100644 --- a/native_locator/src/common_python.rs +++ b/native_locator/src/common_python.rs @@ -30,6 +30,7 @@ fn report_path_python(dispatcher: &mut impl messaging::MessageDispatcher, path: messaging::PythonEnvironmentCategory::System, version, None, + env_path.clone(), env_path, )); } diff --git a/native_locator/src/conda.rs b/native_locator/src/conda.rs index d7c2995db89e..6bf50ab96b89 100644 --- a/native_locator/src/conda.rs +++ b/native_locator/src/conda.rs @@ -380,6 +380,7 @@ pub fn find_and_report( let envs = get_distinct_conda_envs(conda_binary.to_path_buf(), environment); for env in envs { let executable = find_python_binary_path(Path::new(&env.path)); + let env_path = env.path.to_string_lossy().to_string(); let params = messaging::PythonEnvironment::new( env.name.to_string(), match executable { @@ -405,7 +406,8 @@ pub fn find_and_report( "python".to_string(), ]) }, - Some(env.path.to_string_lossy().to_string()), + Some(env_path.clone()), + Some(env_path), ); let message = messaging::PythonEnvironmentMessage::new(params); dispatcher.send_message(message); diff --git a/native_locator/src/messaging.rs b/native_locator/src/messaging.rs index a079e0a39f98..dee13bae0f87 100644 --- a/native_locator/src/messaging.rs +++ b/native_locator/src/messaging.rs @@ -64,6 +64,7 @@ pub struct PythonEnvironment { pub version: Option, pub activated_run: Option>, pub env_path: Option, + pub sys_prefix_path: Option, } impl PythonEnvironment { @@ -74,6 +75,7 @@ impl PythonEnvironment { version: Option, activated_run: Option>, env_path: Option, + sys_prefix_path: Option, ) -> Self { Self { name, @@ -82,6 +84,7 @@ impl PythonEnvironment { version, activated_run, env_path, + sys_prefix_path } } } diff --git a/native_locator/src/pyenv.rs b/native_locator/src/pyenv.rs index 1787aa8ef841..bce5b4dfa19c 100644 --- a/native_locator/src/pyenv.rs +++ b/native_locator/src/pyenv.rs @@ -94,6 +94,7 @@ pub fn find_and_report( if path.is_dir() { if let Some(executable) = find_python_binary_path(&path) { let version = path.file_name().unwrap().to_string_lossy().to_string(); + let env_path = path.to_string_lossy().to_string(); dispatcher.send_message(messaging::PythonEnvironment::new( "Python".to_string(), vec![executable.into_os_string().into_string().unwrap()], @@ -104,7 +105,8 @@ pub fn find_and_report( "shell".to_string(), version, ]), - Some(path.into_os_string().into_string().unwrap()), + Some(env_path.clone()), + Some(env_path), )); } } diff --git a/native_locator/src/windows_python.rs b/native_locator/src/windows_python.rs index 860cec1f7ff3..122f4eabd832 100644 --- a/native_locator/src/windows_python.rs +++ b/native_locator/src/windows_python.rs @@ -15,6 +15,7 @@ fn report_path_python(path: &str, dispatcher: &mut impl messaging::MessageDispat version, None, None, + None, )); } diff --git a/native_locator/tests/common_python_test.rs b/native_locator/tests/common_python_test.rs index 0f5b1853e7f8..31d8b8c52f63 100644 --- a/native_locator/tests/common_python_test.rs +++ b/native_locator/tests/common_python_test.rs @@ -27,6 +27,6 @@ fn find_python_in_path_this() { common_python::find_and_report(&mut dispatcher, &known); assert_eq!(dispatcher.messages.len(), 1); - let expected_json = json!({"name":"Python","pythonExecutablePath":[unix_python_exe.clone()],"category":"system","version":null,"activatedRun":null,"envPath":unix_python.clone()}); + let expected_json = json!({"name":"Python","pythonExecutablePath":[unix_python_exe.clone()],"category":"system","version":null,"activatedRun":null,"envPath":unix_python.clone(),"sysPrefixPath":unix_python.clone()}); assert_messages(&[expected_json], &dispatcher); } diff --git a/src/client/pythonEnvironments/base/locators/lowLevel/nativeLocator.ts b/src/client/pythonEnvironments/base/locators/lowLevel/nativeLocator.ts index 8aa4631b8e94..a91c92462457 100644 --- a/src/client/pythonEnvironments/base/locators/lowLevel/nativeLocator.ts +++ b/src/client/pythonEnvironments/base/locators/lowLevel/nativeLocator.ts @@ -22,6 +22,7 @@ interface NativeEnvInfo { version?: string; activatedRun?: string[]; envPath?: string; + sysPrefixPath?: string; } interface EnvManager {