forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix debugging of pyramid applications
- Loading branch information
1 parent
74c9702
commit 849009b
Showing
8 changed files
with
125 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
Fix debugging of Pyramid applications on Windows. |
This file contains 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
39 changes: 39 additions & 0 deletions
39
src/client/debugger/configProviders/configurationProviderUtils.ts
This file contains 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,39 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
'use strict'; | ||
|
||
import { inject, injectable } from 'inversify'; | ||
import * as path from 'path'; | ||
import { Uri } from 'vscode'; | ||
import { IApplicationShell } from '../../common/application/types'; | ||
import { IFileSystem } from '../../common/platform/types'; | ||
import { IPythonExecutionFactory } from '../../common/process/types'; | ||
import { IServiceContainer } from '../../ioc/types'; | ||
import { IConfigurationProviderUtils } from './types'; | ||
|
||
const PSERVE_SCRIPT_FILE_NAME = 'pserve.py'; | ||
|
||
@injectable() | ||
export class ConfigurationProviderUtils implements IConfigurationProviderUtils { | ||
private readonly executionFactory: IPythonExecutionFactory; | ||
private readonly fs: IFileSystem; | ||
constructor(@inject(IServiceContainer) private serviceContainer: IServiceContainer) { | ||
this.executionFactory = this.serviceContainer.get<IPythonExecutionFactory>(IPythonExecutionFactory); | ||
this.fs = this.serviceContainer.get<IFileSystem>(IFileSystem); | ||
} | ||
public async getPyramidStartupScriptFilePath(resource?: Uri): Promise<string | undefined> { | ||
try { | ||
const executionService = await this.executionFactory.create(resource); | ||
const output = await executionService.exec(['-c', 'import pyramid;print(pyramid.__file__)'], { throwOnStdErr: true }); | ||
const pserveFilePath = path.join(path.dirname(output.stdout.trim()), 'scripts', PSERVE_SCRIPT_FILE_NAME); | ||
return await this.fs.fileExistsAsync(pserveFilePath) ? pserveFilePath : undefined; | ||
} catch (ex) { | ||
const message = 'Unable to locate \'pserve.py\' required for debugging of Pyramid applications.'; | ||
console.error(message, ex); | ||
const app = this.serviceContainer.get<IApplicationShell>(IApplicationShell); | ||
app.showErrorMessage(message); | ||
return; | ||
} | ||
} | ||
} |
This file contains 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 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 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 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,12 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
'use strict'; | ||
|
||
import { Uri } from 'vscode'; | ||
|
||
export const IConfigurationProviderUtils = Symbol('IConfigurationProviderUtils'); | ||
|
||
export interface IConfigurationProviderUtils { | ||
getPyramidStartupScriptFilePath(resource?: Uri): Promise<string | undefined>; | ||
} |
Oops, something went wrong.