Skip to content

Commit 1cc490b

Browse files
authored
Add executable path as id for envs (microsoft#23840)
1 parent d2646dc commit 1cc490b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/client/pythonEnvironments/nativeAPI.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,14 @@ function toPythonEnvInfo(nativeEnv: NativeEnvInfo): PythonEnvInfo | undefined {
162162
? getDisplayName(version, kind, arch, name)
163163
: nativeEnv.displayName ?? 'Python';
164164

165+
const executable = nativeEnv.executable ?? makeExecutablePath(nativeEnv.prefix);
165166
return {
166167
name,
167168
location: getLocation(nativeEnv),
168169
kind,
170+
id: executable,
169171
executable: {
170-
filename: nativeEnv.executable ?? makeExecutablePath(nativeEnv.prefix),
172+
filename: executable,
171173
sysPrefix: nativeEnv.prefix ?? '',
172174
ctime: -1,
173175
mtime: -1,

src/test/pythonEnvironments/nativeAPI.unit.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ suite('Native Python API', () => {
4141

4242
const expectedBasicEnv: PythonEnvInfo = {
4343
arch: Architecture.Unknown,
44+
id: '/usr/bin/python',
4445
detailedDisplayName: "Python 3.12.0 ('basic_python')",
4546
display: "Python 3.12.0 ('basic_python')",
4647
distro: { org: '' },
@@ -89,6 +90,7 @@ suite('Native Python API', () => {
8990
detailedDisplayName: "Python 3.12.0 ('conda_python')",
9091
display: "Python 3.12.0 ('conda_python')",
9192
distro: { org: '' },
93+
id: '/home/user/.conda/envs/conda_python/python',
9294
executable: {
9395
filename: '/home/user/.conda/envs/conda_python/python',
9496
sysPrefix: '/home/user/.conda/envs/conda_python',
@@ -108,6 +110,7 @@ suite('Native Python API', () => {
108110
detailedDisplayName: 'Conda Python',
109111
display: 'Conda Python',
110112
distro: { org: '' },
113+
id: exePath,
111114
executable: {
112115
filename: exePath,
113116
sysPrefix: '/home/user/.conda/envs/conda_python',

0 commit comments

Comments
 (0)