forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Common execution for python tool or module #468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
DonJayamanne
merged 80 commits into
microsoft:master
from
DonJayamanne:CommonToolExecution
Jan 3, 2018
Merged
Changes from all commits
Commits
Show all changes
80 commits
Select commit
Hold shift + click to select a range
ecc1ca9
Fix Microsoft/vscode#37627 (#1368)
octref 7c5778c
Version 0.7.0 of extension (#1381)
DonJayamanne 9d1bf82
Update README.md
DonJayamanne ffba179
Update README.md
DonJayamanne 905c713
sync fork with upstream
DonJayamanne acc2109
fix readme
DonJayamanne d470523
Merge branch 'master' of https://github.com/Microsoft/vscode-python
DonJayamanne d392e8b
merged upstream
DonJayamanne 92f775f
Merge remote-tracking branch 'upstream/master'
DonJayamanne 32a6e53
Merge remote-tracking branch 'upstream/master'
DonJayamanne 4b30f2c
Merge remote-tracking branch 'upstream/master'
DonJayamanne e396752
Merge remote-tracking branch 'upstream/master'
DonJayamanne eff4792
Merge remote-tracking branch 'upstream/master'
DonJayamanne 4553c28
Merge remote-tracking branch 'upstream/master'
DonJayamanne 3c6520a
Merge remote-tracking branch 'upstream/master'
DonJayamanne 966e516
Merge remote-tracking branch 'upstream/master'
DonJayamanne 63d2d65
Merge remote-tracking branch 'upstream/master'
DonJayamanne f6d469e
Merge remote-tracking branch 'upstream/master'
DonJayamanne 029e055
Merge remote-tracking branch 'upstream/master'
DonJayamanne e8c71c0
Merge remote-tracking branch 'upstream/master'
DonJayamanne 51cf9d2
Merge remote-tracking branch 'upstream/master'
DonJayamanne 7aadc43
Merge remote-tracking branch 'upstream/master'
DonJayamanne f0f5c59
Merge remote-tracking branch 'upstream/master'
DonJayamanne b2b9da9
Merge remote-tracking branch 'upstream/master'
DonJayamanne 30a4091
Merge remote-tracking branch 'upstream/master'
DonJayamanne b16d2f9
Merge remote-tracking branch 'upstream/master'
DonJayamanne c8db345
Merge remote-tracking branch 'upstream/master'
DonJayamanne 0df7f16
Merge remote-tracking branch 'upstream/master'
DonJayamanne 3ccc881
Merge remote-tracking branch 'upstream/master'
DonJayamanne bb0709e
Merge remote-tracking branch 'upstream/master'
DonJayamanne 2c19004
Merge remote-tracking branch 'upstream/master'
DonJayamanne 8f224ab
Merge remote-tracking branch 'upstream/master'
DonJayamanne 41b7080
Merge remote-tracking branch 'upstream/master'
DonJayamanne dab38dc
Merge remote-tracking branch 'upstream/master'
DonJayamanne ae22dd4
Merge remote-tracking branch 'upstream/master'
DonJayamanne d2340d2
Merge remote-tracking branch 'upstream/master'
DonJayamanne bcb8879
use new exec engine instead of spawning manually
DonJayamanne c6d6f50
refactor to use new execution framework
DonJayamanne 65a949b
refactor to use new exec framework
DonJayamanne c8559ea
fix linter errors
DonJayamanne 51a2802
refactor
DonJayamanne c778493
disable messages and copy config files
DonJayamanne a34a62c
remove old execution layer
DonJayamanne 9452d0e
misc
DonJayamanne 52bb7ae
Merge remote-tracking branch 'upstream/master'
DonJayamanne 5760886
merged master
DonJayamanne 1714f0c
Merge branch 'D' into FixDebuggerEnvVars
DonJayamanne 1bdc95d
fix tests
DonJayamanne 0313000
fix tests
DonJayamanne e7eb19e
disable message D102
DonJayamanne d09b3ef
fix bug introduced into test
DonJayamanne 0467d4c
fix tests
DonJayamanne ffdfd5d
fixed code review comments
DonJayamanne 59ff402
added tests for env variable parsing
DonJayamanne bab860f
remove metadata
DonJayamanne b6b2531
Merge remote-tracking branch 'upstream/master'
DonJayamanne 2b21cec
merged master
DonJayamanne 56d5c60
Merge branch 'FixDebuggerEnvVars' into EnvVarFixes
DonJayamanne 0ea674b
Merge branch 'RefactorJediAndOthers' into EnvVarFixes
DonJayamanne 09d2372
refactor environment variables parser
DonJayamanne 203e13e
fixed linter error
DonJayamanne 21601f2
Fixed code review comments
DonJayamanne 733f9a1
Merge branch 'RefactorJediAndOthers' into EnvVarFixes
DonJayamanne 24fa57e
added tests for env vars service
DonJayamanne 649b7e7
console could be null
DonJayamanne 8d8d2fc
Merge remote-tracking branch 'upstream/master'
DonJayamanne 6641ec8
merged master
DonJayamanne b65d7c0
merged master
DonJayamanne e6c9472
use new env variables service in jedi service
DonJayamanne bf2d5d5
fix #456
DonJayamanne 98b6993
add missing service registrations
DonJayamanne db84ded
Merge branch 'EnvVarFixes' into CommonToolExecution
DonJayamanne 25e4b71
add missing service registration
DonJayamanne 81bec0a
Merge branch 'EnvVarFixes' into CommonToolExecution
DonJayamanne 3bbbaaa
add missing service registration
DonJayamanne 30d0bb5
remove imports of 'reflect-metadata'
DonJayamanne 5eb11dc
Merge branch 'EnvVarFixes' into CommonToolExecution
DonJayamanne c425a55
Merge remote-tracking branch 'upstream/master'
DonJayamanne f8b9eac
merge master
DonJayamanne a0bfee9
resolve merge issue
DonJayamanne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // 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 { ExecutionInfo } from '../types'; | ||
| import { IEnvironmentVariablesProvider } from '../variables/types'; | ||
| import { ExecutionResult, IProcessService, IPythonExecutionFactory, IPythonToolExecutionService, ObservableExecutionResult, SpawnOptions } from './types'; | ||
|
|
||
| @injectable() | ||
| export class PythonToolExecutionService implements IPythonToolExecutionService { | ||
| constructor( @inject(IServiceContainer) private serviceContainer: IServiceContainer) { } | ||
| public async execObservable(executionInfo: ExecutionInfo, options: SpawnOptions, resource: Uri): Promise<ObservableExecutionResult<string>> { | ||
| if (options.env) { | ||
| throw new Error('Environment variables are not supported'); | ||
| } | ||
| if (executionInfo.moduleName && executionInfo.moduleName.length > 0) { | ||
| const pythonExecutionService = await this.serviceContainer.get<IPythonExecutionFactory>(IPythonExecutionFactory).create(resource); | ||
| return pythonExecutionService.execModuleObservable(executionInfo.moduleName, executionInfo.args, options); | ||
| } else { | ||
| const env = await this.serviceContainer.get<IEnvironmentVariablesProvider>(IEnvironmentVariablesProvider).getEnvironmentVariables(resource); | ||
| const processService = this.serviceContainer.get<IProcessService>(IProcessService); | ||
| return processService.execObservable(executionInfo.execPath!, executionInfo.args, { ...options, env }); | ||
| } | ||
| } | ||
| public async exec(executionInfo: ExecutionInfo, options: SpawnOptions, resource: Uri): Promise<ExecutionResult<string>> { | ||
| if (options.env) { | ||
| throw new Error('Environment variables are not supported'); | ||
| } | ||
| if (executionInfo.moduleName && executionInfo.moduleName.length > 0) { | ||
| const pythonExecutionService = await this.serviceContainer.get<IPythonExecutionFactory>(IPythonExecutionFactory).create(resource); | ||
| return pythonExecutionService.execModule(executionInfo.moduleName!, executionInfo.args, options); | ||
| } else { | ||
| const env = await this.serviceContainer.get<IEnvironmentVariablesProvider>(IEnvironmentVariablesProvider).getEnvironmentVariables(resource); | ||
| const processService = this.serviceContainer.get<IProcessService>(IProcessService); | ||
| return processService.exec(executionInfo.execPath!, executionInfo.args, { ...options, env }); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you, but I think there is an option to derive PythonTestExecutionService, override handling and push instance in the test service registry. This way you won't have to have test code in the main module.