Skip to content

Commit 1f9b370

Browse files
committed
updates based on comments
1 parent 429a009 commit 1f9b370

1 file changed

Lines changed: 15 additions & 19 deletions

File tree

src/managers/conda/condaUtils.ts

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ async function getNamedCondaPythonInfo(
300300
_conda: string, // TODO:: fix this, why is it not being used to build the info object
301301
envManager: EnvironmentManager,
302302
): Promise<PythonEnvironmentInfo> {
303-
const { shellActivation, shellDeactivation } = await generateShellActivationMap2(prefix, envManager, name);
303+
const { shellActivation, shellDeactivation } = await buildShellActivationMapForConda(prefix, envManager, name);
304304
const sv = shortVersion(version);
305305

306306
return {
@@ -345,7 +345,7 @@ async function getPrefixesCondaPythonInfo(
345345
): Promise<PythonEnvironmentInfo> {
346346
const sv = shortVersion(version);
347347

348-
const { shellActivation, shellDeactivation } = await generateShellActivationMap2(prefix, envManager);
348+
const { shellActivation, shellDeactivation } = await buildShellActivationMapForConda(prefix, envManager);
349349

350350
const basename = path.basename(prefix);
351351
return {
@@ -386,12 +386,11 @@ interface ShellCommandMaps {
386386
* @param name Optional name of the conda environment. If provided, used instead of prefix for activation
387387
* @returns Promise resolving to shell-specific activation/deactivation command maps
388388
*/
389-
async function generateShellActivationMap2(
389+
async function buildShellActivationMapForConda(
390390
prefix: string,
391391
envManager: EnvironmentManager,
392392
name?: string,
393393
): Promise<ShellCommandMaps> {
394-
// Array to collect all logs
395394
const logs: string[] = [];
396395
let shellMaps: ShellCommandMaps;
397396

@@ -502,26 +501,23 @@ async function generateShellActivationMapFromConfig(
502501
): Promise<ShellCommandMaps> {
503502
const shellActivation: Map<string, PythonCommandRunConfiguration[]> = new Map();
504503
const shellDeactivation: Map<string, PythonCommandRunConfiguration[]> = new Map();
504+
shellActivation.set(ShellConstants.GITBASH, activate);
505+
shellDeactivation.set(ShellConstants.GITBASH, deactivate);
505506

506-
if (isWindows()) {
507-
shellActivation.set(ShellConstants.GITBASH, activate);
508-
shellDeactivation.set(ShellConstants.GITBASH, deactivate);
507+
shellActivation.set(ShellConstants.CMD, activate);
508+
shellDeactivation.set(ShellConstants.CMD, deactivate);
509509

510-
shellActivation.set(ShellConstants.CMD, activate);
511-
shellDeactivation.set(ShellConstants.CMD, deactivate);
510+
shellActivation.set(ShellConstants.BASH, activate);
511+
shellDeactivation.set(ShellConstants.BASH, deactivate);
512512

513-
shellActivation.set(ShellConstants.PWSH, activate);
514-
shellDeactivation.set(ShellConstants.PWSH, deactivate);
515-
} else {
516-
shellActivation.set(ShellConstants.BASH, activate);
517-
shellDeactivation.set(ShellConstants.BASH, deactivate);
513+
shellActivation.set(ShellConstants.SH, activate);
514+
shellDeactivation.set(ShellConstants.SH, deactivate);
518515

519-
shellActivation.set(ShellConstants.SH, activate);
520-
shellDeactivation.set(ShellConstants.SH, deactivate);
516+
shellActivation.set(ShellConstants.ZSH, activate);
517+
shellDeactivation.set(ShellConstants.ZSH, deactivate);
521518

522-
shellActivation.set(ShellConstants.ZSH, activate);
523-
shellDeactivation.set(ShellConstants.ZSH, deactivate);
524-
}
519+
shellActivation.set(ShellConstants.PWSH, activate);
520+
shellDeactivation.set(ShellConstants.PWSH, deactivate);
525521

526522
return { shellActivation, shellDeactivation };
527523
}

0 commit comments

Comments
 (0)