Skip to content

Commit 62659b0

Browse files
author
Kartik Raj
committed
Remove code
1 parent f55dfb7 commit 62659b0

File tree

68 files changed

+55
-9258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+55
-9258
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,6 @@ jobs:
211211
& $condaPythonPath ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} condaPath
212212
& $condaExecPath init --all
213213
214-
# 2. For `interpreterLocatorService.testvirtualenvs.ts`
215-
216-
& $condaExecPath create -n "test_env1" -y python
217-
& $condaExecPath create -p "./test_env2" -y python
218-
& $condaExecPath create -p "~/test_env3" -y python
219-
220214
- name: Set CI_PYTHON_PATH and CI_DISABLE_AUTO_SELECTION
221215
run: |
222216
echo "CI_PYTHON_PATH=python" >> $GITHUB_ENV

.github/workflows/pr-check.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,6 @@ jobs:
191191
& $condaPythonPath ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} condaPath
192192
& $condaExecPath init --all
193193
194-
# 2. For `interpreterLocatorService.testvirtualenvs.ts`
195-
196-
& $condaExecPath create -n "test_env1" -y python
197-
& $condaExecPath create -p "./test_env2" -y python
198-
& $condaExecPath create -p "~/test_env3" -y python
199-
200194
- name: Set CI_PYTHON_PATH and CI_DISABLE_AUTO_SELECTION
201195
run: |
202196
echo "CI_PYTHON_PATH=python" >> $GITHUB_ENV
@@ -458,12 +452,6 @@ jobs:
458452
& $condaPythonPath ./build/ci/addEnvPath.py ${{ env.PYTHON_VIRTUAL_ENVS_LOCATION }} condaPath
459453
& $condaExecPath init --all
460454
461-
# 2. For `interpreterLocatorService.testvirtualenvs.ts`
462-
463-
& $condaExecPath create -n "test_env1" -y python
464-
& $condaExecPath create -p "./test_env2" -y python
465-
& $condaExecPath create -p "~/test_env3" -y python
466-
467455
- name: Run TypeScript unit tests
468456
run: npm run test:unittests:cover
469457

src/client/common/terminal/environmentActivationProviders/baseActivationProvider.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,44 @@ import { inject, injectable } from 'inversify';
55
import * as path from 'path';
66
import { Uri } from 'vscode';
77
import { IServiceContainer } from '../../../ioc/types';
8-
import { getVenvExecutableFinder } from '../../../pythonEnvironments/discovery/subenv';
98
import { IFileSystem } from '../../platform/types';
109
import { IConfigurationService } from '../../types';
1110
import { ITerminalActivationCommandProvider, TerminalShellType } from '../types';
1211

12+
type ExecutableFinderFunc = (python: string) => Promise<string | undefined>;
13+
14+
/**
15+
* Build an "executable finder" function that identifies venv environments.
16+
*
17+
* @param basename - the venv name or names to look for
18+
* @param pathDirname - typically `path.dirname`
19+
* @param pathJoin - typically `path.join`
20+
* @param fileExists - typically `fs.exists`
21+
*/
22+
23+
function getVenvExecutableFinder(
24+
basename: string | string[],
25+
// <path>
26+
pathDirname: (filename: string) => string,
27+
pathJoin: (...parts: string[]) => string,
28+
// </path>
29+
fileExists: (n: string) => Promise<boolean>,
30+
): ExecutableFinderFunc {
31+
const basenames = typeof basename === 'string' ? [basename] : basename;
32+
return async (python: string) => {
33+
// Generated scripts are found in the same directory as the interpreter.
34+
const binDir = pathDirname(python);
35+
for (const name of basenames) {
36+
const filename = pathJoin(binDir, name);
37+
if (await fileExists(filename)) {
38+
return filename;
39+
}
40+
}
41+
// No matches so return undefined.
42+
return undefined;
43+
};
44+
}
45+
1346
@injectable()
1447
abstract class BaseActivationCommandProvider implements ITerminalActivationCommandProvider {
1548
constructor(@inject(IServiceContainer) protected readonly serviceContainer: IServiceContainer) {}

src/client/interpreter/contracts.ts

Lines changed: 2 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,15 @@
11
import { SemVer } from 'semver';
22
import { CodeLensProvider, ConfigurationTarget, Disposable, Event, TextDocument, Uri } from 'vscode';
3-
import { IExtensionSingleActivationService } from '../activation/types';
43
import { FileChangeType } from '../common/platform/fileSystemWatcher';
54
import { Resource } from '../common/types';
65
import { PythonEnvSource } from '../pythonEnvironments/base/info';
76
import { PythonLocatorQuery } from '../pythonEnvironments/base/locator';
8-
import { CondaEnvironmentInfo, CondaInfo } from '../pythonEnvironments/common/environmentManagers/conda';
7+
import { CondaEnvironmentInfo } from '../pythonEnvironments/common/environmentManagers/conda';
98
import { EnvironmentType, PythonEnvironment } from '../pythonEnvironments/info';
109

11-
export const INTERPRETER_LOCATOR_SERVICE = 'IInterpreterLocatorService';
12-
export const WINDOWS_REGISTRY_SERVICE = 'WindowsRegistryService';
13-
export const CONDA_ENV_FILE_SERVICE = 'CondaEnvFileService';
14-
export const CONDA_ENV_SERVICE = 'CondaEnvService';
15-
export const CURRENT_PATH_SERVICE = 'CurrentPathService';
16-
export const KNOWN_PATH_SERVICE = 'KnownPathsService';
17-
export const GLOBAL_VIRTUAL_ENV_SERVICE = 'VirtualEnvService';
18-
export const WORKSPACE_VIRTUAL_ENV_SERVICE = 'WorkspaceVirtualEnvService';
19-
export const PIPENV_SERVICE = 'PipEnvService';
2010
export const IInterpreterVersionService = Symbol('IInterpreterVersionService');
2111
export interface IInterpreterVersionService {
2212
getVersion(pythonPath: string, defaultValue: string): Promise<string>;
23-
getPipVersion(pythonPath: string): Promise<string>;
24-
}
25-
26-
export const IKnownSearchPathsForInterpreters = Symbol('IKnownSearchPathsForInterpreters');
27-
export interface IKnownSearchPathsForInterpreters {
28-
getSearchPaths(): string[];
29-
}
30-
export const IVirtualEnvironmentsSearchPathProvider = Symbol('IVirtualEnvironmentsSearchPathProvider');
31-
export interface IVirtualEnvironmentsSearchPathProvider {
32-
getSearchPaths(resource?: Uri): Promise<string[]>;
3313
}
3414

3515
export type PythonEnvironmentsChangedEvent = {
@@ -74,15 +54,6 @@ export interface IComponentAdapter {
7454
isWindowsStoreInterpreter(pythonPath: string): Promise<boolean>;
7555
}
7656

77-
export const IInterpreterLocatorService = Symbol('IInterpreterLocatorService');
78-
79-
export interface IInterpreterLocatorService extends Disposable {
80-
readonly onLocating: Event<Promise<PythonEnvironment[]>>;
81-
readonly hasInterpreters: Promise<boolean>;
82-
didTriggerInterpreterSuggestions?: boolean;
83-
getInterpreters(resource?: Uri, options?: GetInterpreterOptions): Promise<PythonEnvironment[]>;
84-
}
85-
8657
export const ICondaService = Symbol('ICondaService');
8758
/**
8859
* Interface carries the properties which are not available via the discovery component interface.
@@ -94,20 +65,6 @@ export interface ICondaService {
9465
getCondaFileFromInterpreter(interpreterPath?: string, envName?: string): Promise<string | undefined>;
9566
}
9667

97-
export const ICondaLocatorService = Symbol('ICondaLocatorService');
98-
/**
99-
* @deprecated Use the new discovery component when in experiment, use this otherwise.
100-
*/
101-
export interface ICondaLocatorService {
102-
readonly condaEnvironmentsFile: string | undefined;
103-
getCondaFile(): Promise<string>;
104-
getCondaInfo(): Promise<CondaInfo | undefined>;
105-
getCondaEnvironments(ignoreCache: boolean): Promise<CondaEnvironmentInfo[] | undefined>;
106-
getInterpreterPath(condaEnvironmentPath: string): string;
107-
isCondaEnvironment(interpreterPath: string): Promise<boolean>;
108-
getCondaEnvironment(interpreterPath: string): Promise<CondaEnvironmentInfo | undefined>;
109-
}
110-
11168
export const IInterpreterService = Symbol('IInterpreterService');
11269
export interface IInterpreterService {
11370
readonly onRefreshStart: Event<void>;
@@ -119,7 +76,7 @@ export interface IInterpreterService {
11976
onDidChangeInterpreterInformation: Event<PythonEnvironment>;
12077
hasInterpreters(filter?: (e: PythonEnvironment) => Promise<boolean>): Promise<boolean>;
12178
getInterpreters(resource?: Uri): PythonEnvironment[];
122-
getAllInterpreters(resource?: Uri, options?: GetInterpreterOptions): Promise<PythonEnvironment[]>;
79+
getAllInterpreters(resource?: Uri): Promise<PythonEnvironment[]>;
12380
getActiveInterpreter(resource?: Uri): Promise<PythonEnvironment | undefined>;
12481
getInterpreterDetails(pythonPath: string, resoure?: Uri): Promise<undefined | PythonEnvironment>;
12582
refresh(resource: Resource): Promise<void>;
@@ -146,33 +103,6 @@ export interface IInterpreterHelper {
146103
getBestInterpreter(interpreters?: PythonEnvironment[]): PythonEnvironment | undefined;
147104
}
148105

149-
export const IPipEnvService = Symbol('IPipEnvService');
150-
export interface IPipEnvService extends IInterpreterLocatorService {
151-
executable: string;
152-
isRelatedPipEnvironment(dir: string, pythonPath: string): Promise<boolean>;
153-
}
154-
155-
export const IInterpreterLocatorHelper = Symbol('IInterpreterLocatorHelper');
156-
export interface IInterpreterLocatorHelper {
157-
mergeInterpreters(interpreters: PythonEnvironment[]): Promise<PythonEnvironment[]>;
158-
}
159-
160-
export const IInterpreterWatcher = Symbol('IInterpreterWatcher');
161-
export interface IInterpreterWatcher {
162-
onDidCreate: Event<Resource>;
163-
}
164-
165-
export const IInterpreterWatcherBuilder = Symbol('IInterpreterWatcherBuilder');
166-
export interface IInterpreterWatcherBuilder {
167-
getWorkspaceVirtualEnvInterpreterWatcher(resource: Resource): Promise<IInterpreterWatcher>;
168-
}
169-
170-
export const IInterpreterLocatorProgressService = Symbol('IInterpreterLocatorProgressService');
171-
export interface IInterpreterLocatorProgressService extends IExtensionSingleActivationService {
172-
readonly onRefreshing: Event<void>;
173-
readonly onRefreshed: Event<void>;
174-
}
175-
176106
export const IInterpreterStatusbarVisibilityFilter = Symbol('IInterpreterStatusbarVisibilityFilter');
177107
/**
178108
* Implement this interface to control the visibility of the interpreter statusbar.
@@ -186,5 +116,3 @@ export type WorkspacePythonPath = {
186116
folderUri: Uri;
187117
configTarget: ConfigurationTarget.Workspace | ConfigurationTarget.WorkspaceFolder;
188118
};
189-
190-
export type GetInterpreterOptions = { ignoreCache?: boolean; onSuggestion?: boolean };
Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import { inject, injectable } from 'inversify';
22
import '../common/extensions';
3-
import * as internalPython from '../common/process/internal/python';
43
import { IProcessServiceFactory } from '../common/process/types';
54
import { getPythonVersion } from '../pythonEnvironments/info/pythonVersion';
65
import { IInterpreterVersionService } from './contracts';
76

8-
const PIP_VERSION_REGEX = '\\d+\\.\\d+(\\.\\d+)?';
9-
107
@injectable()
118
export class InterpreterVersionService implements IInterpreterVersionService {
129
constructor(@inject(IProcessServiceFactory) private readonly processServiceFactory: IProcessServiceFactory) {}
@@ -17,21 +14,4 @@ export class InterpreterVersionService implements IInterpreterVersionService {
1714
processService.exec(cmd, args, { mergeStdOutErr: true }),
1815
);
1916
}
20-
21-
public async getPipVersion(pythonPath: string): Promise<string> {
22-
const [args, parse] = internalPython.getModuleVersion('pip');
23-
const processService = await this.processServiceFactory.create();
24-
const output = await processService.exec(pythonPath, args, { mergeStdOutErr: true });
25-
const version = parse(output.stdout);
26-
if (version.length > 0) {
27-
// Here's a sample output:
28-
// pip 9.0.1 from /Users/donjayamanne/anaconda3/lib/python3.6/site-packages (python 3.6).
29-
const re = new RegExp(PIP_VERSION_REGEX, 'g');
30-
const matches = re.exec(version);
31-
if (matches && matches.length > 0) {
32-
return matches[0].trim();
33-
}
34-
}
35-
throw new Error(`Unable to determine pip version from output '${output.stdout}'`);
36-
}
3717
}

src/client/interpreter/virtualEnvs/index.ts

Lines changed: 0 additions & 147 deletions
This file was deleted.

0 commit comments

Comments
 (0)