forked from DonJayamanne/pythonVSCode
-
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.1 KB
/
Copy pathpythonExecutionFactory.ts
File metadata and controls
23 lines (21 loc) · 1.1 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 'reflect-metadata';
import { Uri } from 'vscode';
import { PythonSettings } from '../configSettings';
import { IEnvironmentVariablesProvider } from '../variables/types';
import { PythonExecutionService } from './pythonProcess';
import { IProcessService, IPythonExecutionFactory, IPythonExecutionService } from './types';
@injectable()
export class PythonExecutionFactory implements IPythonExecutionFactory {
constructor( @inject(IProcessService) private procService: IProcessService,
@inject(IEnvironmentVariablesProvider) private envVarsService: IEnvironmentVariablesProvider) { }
public async create(resource?: Uri): Promise<IPythonExecutionService> {
const settings = PythonSettings.getInstance(resource);
return this.envVarsService.getEnvironmentVariables(true, resource)
.then(customEnvVars => {
return new PythonExecutionService(this.procService, settings.pythonPath, customEnvVars);
});
}
}