Skip to content

Commit

Permalink
Add executable path as id for envs (microsoft#23840)
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig authored and eleanorjboyd committed Jul 30, 2024
1 parent 40d426c commit 4eb9b6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/pythonEnvironments/nativeAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/test/pythonEnvironments/nativeAPI.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: '' },
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down

0 comments on commit 4eb9b6c

Please sign in to comment.