forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
90 lines (82 loc) · 3.22 KB
/
types.ts
File metadata and controls
90 lines (82 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { CancellationToken, Uri } from 'vscode';
import { ModuleInstallerType, PythonEnvironment } from '../../pythonEnvironments/info';
import { InstallerResponse, Product, ProductInstallStatus, ProductType, Resource } from '../types';
export type InterpreterUri = Resource | PythonEnvironment;
export const IModuleInstaller = Symbol('IModuleInstaller');
export interface IModuleInstaller {
readonly name: string;
readonly displayName: string;
readonly priority: number;
readonly type: ModuleInstallerType;
/**
* Installs a module
* If a cancellation token is provided, then a cancellable progress message is dispalyed.
* At this point, this method would resolve only after the module has been successfully installed.
* If cancellation token is not provided, its not guaranteed that module installation has completed.
* @param {string} name
* @param {InterpreterUri} [resource]
* @param {CancellationToken} [cancel]
* @returns {Promise<void>}
* @memberof IModuleInstaller
*/
installModule(
productOrModuleName: Product | string,
resource?: InterpreterUri,
cancel?: CancellationToken,
flags?: ModuleInstallFlags,
options?: InstallOptions,
): Promise<void>;
isSupported(resource?: InterpreterUri): Promise<boolean>;
}
export const IBaseInstaller = Symbol('IBaseInstaller');
export interface IBaseInstaller {
install(
product: Product,
resource?: InterpreterUri,
cancel?: CancellationToken,
flags?: ModuleInstallFlags,
options?: InstallOptions,
): Promise<InstallerResponse>;
promptToInstall(
product: Product,
resource?: InterpreterUri,
cancel?: CancellationToken,
flags?: ModuleInstallFlags,
): Promise<InstallerResponse>;
isProductVersionCompatible(
product: Product,
semVerRequirement: string,
resource?: InterpreterUri,
): Promise<ProductInstallStatus>;
isInstalled(product: Product, resource?: InterpreterUri): Promise<boolean>;
}
export const IPythonInstallation = Symbol('IPythonInstallation');
export interface IPythonInstallation {
checkInstallation(): Promise<boolean>;
}
export const IInstallationChannelManager = Symbol('IInstallationChannelManager');
export interface IInstallationChannelManager {
getInstallationChannel(product: Product, resource?: InterpreterUri): Promise<IModuleInstaller | undefined>;
getInstallationChannels(resource?: InterpreterUri): Promise<IModuleInstaller[]>;
showNoInstallersMessage(): void;
}
export const IProductService = Symbol('IProductService');
export interface IProductService {
getProductType(product: Product): ProductType;
}
export const IProductPathService = Symbol('IProductPathService');
export interface IProductPathService {
getExecutableNameFromSettings(product: Product, resource?: Uri): string;
isExecutableAModule(product: Product, resource?: Uri): boolean;
}
export enum ModuleInstallFlags {
upgrade = 1,
updateDependencies = 2,
reInstall = 4,
installPipIfRequired = 8,
}
export type InstallOptions = {
installAsProcess?: boolean;
};