forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpythonExecutionFactory.ts
More file actions
23 lines (21 loc) · 1.07 KB
/
Copy pathpythonExecutionFactory.ts
File metadata and controls
23 lines (21 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { inject, injectable } from 'inversify';
import { Uri } from 'vscode';
import { IServiceContainer } from '../../ioc/types';
import { IEnvironmentVariablesProvider } from '../variables/types';
import { PythonExecutionService } from './pythonProcess';
import { IPythonExecutionFactory, IPythonExecutionService } from './types';
@injectable()
export class PythonExecutionFactory implements IPythonExecutionFactory {
private envVarsService: IEnvironmentVariablesProvider;
constructor(@inject(IServiceContainer) private serviceContainer: IServiceContainer) {
this.envVarsService = serviceContainer.get<IEnvironmentVariablesProvider>(IEnvironmentVariablesProvider);
}
public async create(resource?: Uri): Promise<IPythonExecutionService> {
return this.envVarsService.getEnvironmentVariables(resource)
.then(customEnvVars => {
return new PythonExecutionService(this.serviceContainer, customEnvVars, resource);
});
}
}