|
1 | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
2 | 2 | // Licensed under the MIT License. |
3 | 3 |
|
4 | | -import { Terminal, Uri, WorkspaceFolder } from 'vscode'; |
| 4 | +import { Terminal, Uri } from 'vscode'; |
5 | 5 | import { getEnvExtApi, getEnvironment } from './api.internal'; |
6 | 6 | import { EnvironmentType, PythonEnvironment as PythonEnvironmentLegacy } from '../pythonEnvironments/info'; |
7 | 7 | import { PythonEnvironment, PythonTerminalOptions } from './types'; |
8 | 8 | import { Architecture } from '../common/utils/platform'; |
9 | 9 | import { parseVersion } from '../pythonEnvironments/base/info/pythonVersion'; |
10 | 10 | import { PythonEnvType } from '../pythonEnvironments/base/info'; |
11 | | -import { traceError, traceInfo } from '../logging'; |
| 11 | +import { traceError } from '../logging'; |
12 | 12 | import { reportActiveInterpreterChanged } from '../environmentApi'; |
13 | 13 | import { getWorkspaceFolder, getWorkspaceFolders } from '../common/vscodeApis/workspaceApis'; |
14 | 14 |
|
@@ -120,36 +120,6 @@ export async function getActiveInterpreterLegacy(resource?: Uri): Promise<Python |
120 | 120 | return pythonEnv ? toLegacyType(pythonEnv) : undefined; |
121 | 121 | } |
122 | 122 |
|
123 | | -export async function ensureEnvironmentContainsPythonLegacy( |
124 | | - pythonPath: string, |
125 | | - workspaceFolder: WorkspaceFolder | undefined, |
126 | | - callback: () => void, |
127 | | -): Promise<void> { |
128 | | - const api = await getEnvExtApi(); |
129 | | - const pythonEnv = await api.resolveEnvironment(Uri.file(pythonPath)); |
130 | | - if (!pythonEnv) { |
131 | | - traceError(`EnvExt: Failed to resolve environment for ${pythonPath}`); |
132 | | - return; |
133 | | - } |
134 | | - |
135 | | - const envType = toEnvironmentType(pythonEnv); |
136 | | - if (envType === EnvironmentType.Conda) { |
137 | | - const packages = await api.getPackages(pythonEnv); |
138 | | - if (packages && packages.length > 0 && packages.some((pkg) => pkg.name.toLowerCase() === 'python')) { |
139 | | - return; |
140 | | - } |
141 | | - traceInfo(`EnvExt: Python not found in ${envType} environment ${pythonPath}`); |
142 | | - traceInfo(`EnvExt: Installing Python in ${envType} environment ${pythonPath}`); |
143 | | - await api.installPackages(pythonEnv, ['python']); |
144 | | - previousEnvMap.set(workspaceFolder?.uri.fsPath || '', pythonEnv); |
145 | | - reportActiveInterpreterChanged({ |
146 | | - path: pythonPath, |
147 | | - resource: workspaceFolder, |
148 | | - }); |
149 | | - callback(); |
150 | | - } |
151 | | -} |
152 | | - |
153 | 123 | export async function setInterpreterLegacy(pythonPath: string, uri: Uri | undefined): Promise<void> { |
154 | 124 | const api = await getEnvExtApi(); |
155 | 125 | const pythonEnv = await api.resolveEnvironment(Uri.file(pythonPath)); |
|
0 commit comments