From 1cc490bb49f6131e57a53257077105e89ff511f2 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Fri, 19 Jul 2024 09:27:59 -0700 Subject: [PATCH] Add executable path as `id` for envs (#23840) --- src/client/pythonEnvironments/nativeAPI.ts | 4 +++- src/test/pythonEnvironments/nativeAPI.unit.test.ts | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/pythonEnvironments/nativeAPI.ts b/src/client/pythonEnvironments/nativeAPI.ts index 6690beebf7c9..8f12addabfb4 100644 --- a/src/client/pythonEnvironments/nativeAPI.ts +++ b/src/client/pythonEnvironments/nativeAPI.ts @@ -162,12 +162,14 @@ function toPythonEnvInfo(nativeEnv: NativeEnvInfo): PythonEnvInfo | undefined { ? getDisplayName(version, kind, arch, name) : nativeEnv.displayName ?? 'Python'; + const executable = nativeEnv.executable ?? makeExecutablePath(nativeEnv.prefix); return { name, location: getLocation(nativeEnv), kind, + id: executable, executable: { - filename: nativeEnv.executable ?? makeExecutablePath(nativeEnv.prefix), + filename: executable, sysPrefix: nativeEnv.prefix ?? '', ctime: -1, mtime: -1, diff --git a/src/test/pythonEnvironments/nativeAPI.unit.test.ts b/src/test/pythonEnvironments/nativeAPI.unit.test.ts index 89be5dc374e2..e40016595a7b 100644 --- a/src/test/pythonEnvironments/nativeAPI.unit.test.ts +++ b/src/test/pythonEnvironments/nativeAPI.unit.test.ts @@ -41,6 +41,7 @@ suite('Native Python API', () => { const expectedBasicEnv: PythonEnvInfo = { arch: Architecture.Unknown, + id: '/usr/bin/python', detailedDisplayName: "Python 3.12.0 ('basic_python')", display: "Python 3.12.0 ('basic_python')", distro: { org: '' }, @@ -89,6 +90,7 @@ suite('Native Python API', () => { detailedDisplayName: "Python 3.12.0 ('conda_python')", display: "Python 3.12.0 ('conda_python')", distro: { org: '' }, + id: '/home/user/.conda/envs/conda_python/python', executable: { filename: '/home/user/.conda/envs/conda_python/python', sysPrefix: '/home/user/.conda/envs/conda_python', @@ -108,6 +110,7 @@ suite('Native Python API', () => { detailedDisplayName: 'Conda Python', display: 'Conda Python', distro: { org: '' }, + id: exePath, executable: { filename: exePath, sysPrefix: '/home/user/.conda/envs/conda_python',