1+ import * as fsapi from 'fs-extra' ;
2+ import * as os from 'os' ;
3+ import * as path from 'path' ;
14import { l10n , LogOutputChannel , ProgressLocation , QuickPickItem , QuickPickItemKind , ThemeIcon , Uri } from 'vscode' ;
25import {
36 EnvironmentManager ,
@@ -6,36 +9,33 @@ import {
69 PythonEnvironmentApi ,
710 PythonEnvironmentInfo ,
811} from '../../api' ;
9- import * as path from 'path' ;
10- import * as os from 'os' ;
11- import * as fsapi from 'fs-extra' ;
12- import { resolveSystemPythonEnvironmentPath } from './utils' ;
1312import { ENVS_EXTENSION_ID } from '../../common/constants' ;
13+ import { Common , VenvManagerStrings } from '../../common/localize' ;
14+ import { getWorkspacePersistentState } from '../../common/persistentState' ;
15+ import { pickEnvironmentFrom } from '../../common/pickers/environments' ;
16+ import { EventNames } from '../../common/telemetry/constants' ;
17+ import { sendTelemetryEvent } from '../../common/telemetry/sender' ;
18+ import { isWindows } from '../../common/utils/platformUtils' ;
19+ import {
20+ showErrorMessage ,
21+ showInputBox ,
22+ showOpenDialog ,
23+ showQuickPick ,
24+ showWarningMessage ,
25+ withProgress ,
26+ } from '../../common/window.apis' ;
27+ import { getConfiguration } from '../../common/workspace.apis' ;
28+ import { ShellConstants } from '../../features/common/shellConstants' ;
1429import {
1530 isNativeEnvInfo ,
1631 NativeEnvInfo ,
1732 NativePythonEnvironmentKind ,
1833 NativePythonFinder ,
1934} from '../common/nativePythonFinder' ;
20- import { getWorkspacePersistentState } from '../../common/persistentState' ;
2135import { shortVersion , sortEnvironments } from '../common/utils' ;
22- import { getConfiguration } from '../../common/workspace.apis' ;
23- import { pickEnvironmentFrom } from '../../common/pickers/environments' ;
24- import {
25- showQuickPick ,
26- withProgress ,
27- showWarningMessage ,
28- showInputBox ,
29- showOpenDialog ,
30- showErrorMessage ,
31- } from '../../common/window.apis' ;
32- import { Common , VenvManagerStrings } from '../../common/localize' ;
33- import { isUvInstalled , runUV , runPython } from './helpers' ;
36+ import { isUvInstalled , runPython , runUV } from './helpers' ;
3437import { getProjectInstallable , getWorkspacePackagesToInstall , PipPackages } from './pipUtils' ;
35- import { isWindows } from '../../common/utils/platformUtils' ;
36- import { sendTelemetryEvent } from '../../common/telemetry/sender' ;
37- import { EventNames } from '../../common/telemetry/constants' ;
38- import { ShellConstants } from '../../features/common/shellConstants' ;
38+ import { resolveSystemPythonEnvironmentPath } from './utils' ;
3939
4040export const VENV_WORKSPACE_KEY = `${ ENVS_EXTENSION_ID } :venv:WORKSPACE_SELECTED` ;
4141export const VENV_GLOBAL_KEY = `${ ENVS_EXTENSION_ID } :venv:GLOBAL_SELECTED` ;
@@ -136,24 +136,22 @@ async function getPythonInfo(env: NativeEnvInfo): Promise<PythonEnvironmentInfo>
136136 shellDeactivation . set ( 'unknown' , [ { executable : 'deactivate' } ] ) ;
137137 }
138138
139- if ( await fsapi . pathExists ( path . join ( binDir , 'activate' ) ) ) {
140- shellActivation . set ( ShellConstants . SH , [ { executable : 'source' , args : [ path . join ( binDir , `activate` ) ] } ] ) ;
141- shellDeactivation . set ( ShellConstants . SH , [ { executable : 'deactivate' } ] ) ;
139+ shellActivation . set ( ShellConstants . SH , [ { executable : 'source' , args : [ path . join ( binDir , `activate` ) ] } ] ) ;
140+ shellDeactivation . set ( ShellConstants . SH , [ { executable : 'deactivate' } ] ) ;
142141
143- shellActivation . set ( ShellConstants . BASH , [ { executable : 'source' , args : [ path . join ( binDir , `activate` ) ] } ] ) ;
144- shellDeactivation . set ( ShellConstants . BASH , [ { executable : 'deactivate' } ] ) ;
142+ shellActivation . set ( ShellConstants . BASH , [ { executable : 'source' , args : [ path . join ( binDir , `activate` ) ] } ] ) ;
143+ shellDeactivation . set ( ShellConstants . BASH , [ { executable : 'deactivate' } ] ) ;
145144
146- shellActivation . set ( ShellConstants . GITBASH , [
147- { executable : 'source' , args : [ pathForGitBash ( path . join ( binDir , `activate` ) ) ] } ,
148- ] ) ;
149- shellDeactivation . set ( ShellConstants . GITBASH , [ { executable : 'deactivate' } ] ) ;
145+ shellActivation . set ( ShellConstants . GITBASH , [
146+ { executable : 'source' , args : [ pathForGitBash ( path . join ( binDir , `activate` ) ) ] } ,
147+ ] ) ;
148+ shellDeactivation . set ( ShellConstants . GITBASH , [ { executable : 'deactivate' } ] ) ;
150149
151- shellActivation . set ( ShellConstants . ZSH , [ { executable : 'source' , args : [ path . join ( binDir , `activate` ) ] } ] ) ;
152- shellDeactivation . set ( ShellConstants . ZSH , [ { executable : 'deactivate' } ] ) ;
150+ shellActivation . set ( ShellConstants . ZSH , [ { executable : 'source' , args : [ path . join ( binDir , `activate` ) ] } ] ) ;
151+ shellDeactivation . set ( ShellConstants . ZSH , [ { executable : 'deactivate' } ] ) ;
153152
154- shellActivation . set ( ShellConstants . KSH , [ { executable : '.' , args : [ path . join ( binDir , `activate` ) ] } ] ) ;
155- shellDeactivation . set ( ShellConstants . KSH , [ { executable : 'deactivate' } ] ) ;
156- }
153+ shellActivation . set ( ShellConstants . KSH , [ { executable : '.' , args : [ path . join ( binDir , `activate` ) ] } ] ) ;
154+ shellDeactivation . set ( ShellConstants . KSH , [ { executable : 'deactivate' } ] ) ;
157155
158156 if ( await fsapi . pathExists ( path . join ( binDir , 'Activate.ps1' ) ) ) {
159157 shellActivation . set ( ShellConstants . PWSH , [ { executable : '&' , args : [ path . join ( binDir , `Activate.ps1` ) ] } ] ) ;
0 commit comments