Skip to content

Fix poetry discovery #20181

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
merged 1 commit into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/client/extensionActivation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import { registerTypes as tensorBoardRegisterTypes } from './tensorBoard/service
import { registerTypes as commonRegisterTerminalTypes } from './terminals/serviceRegistry';
import { ICodeExecutionManager, ITerminalAutoActivation } from './terminals/types';
import { registerTypes as unitTestsRegisterTypes } from './testing/serviceRegistry';
import { registerTypes as interpretersRegisterTypes } from './interpreter/serviceRegistry';

// components
import * as pythonEnvironments from './pythonEnvironments';
Expand Down Expand Up @@ -131,7 +130,6 @@ async function activateLegacy(ext: ExtensionState): Promise<ActivationResult> {
// Feature specific registrations.
unitTestsRegisterTypes(serviceManager);
lintersRegisterTypes(serviceManager);
interpretersRegisterTypes(serviceManager);
formattersRegisterTypes(serviceManager);
installerRegisterTypes(serviceManager);
commonRegisterTerminalTypes(serviceManager);
Expand Down
2 changes: 2 additions & 0 deletions src/client/extensionInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { STANDARD_OUTPUT_CHANNEL } from './common/constants';
import { registerTypes as platformRegisterTypes } from './common/platform/serviceRegistry';
import { registerTypes as processRegisterTypes } from './common/process/serviceRegistry';
import { registerTypes as commonRegisterTypes } from './common/serviceRegistry';
import { registerTypes as interpretersRegisterTypes } from './interpreter/serviceRegistry';
import {
GLOBAL_MEMENTO,
IDisposableRegistry,
Expand Down Expand Up @@ -85,6 +86,7 @@ export function initializeStandard(ext: ExtensionState): void {
variableRegisterTypes(serviceManager);
platformRegisterTypes(serviceManager);
processRegisterTypes(serviceManager);
interpretersRegisterTypes(serviceManager);

// We will be pulling other code over from activateLegacy().
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,14 @@ export class Poetry {
traceVerbose(`Getting poetry for cwd ${cwd}`);
// Produce a list of candidate binaries to be probed by exec'ing them.
function* getCandidates() {
const customPoetryPath = getPythonSetting<string>('poetryPath');
if (customPoetryPath && customPoetryPath !== 'poetry') {
// If user has specified a custom poetry path, use it first.
yield customPoetryPath;
try {
const customPoetryPath = getPythonSetting<string>('poetryPath');
if (customPoetryPath && customPoetryPath !== 'poetry') {
// If user has specified a custom poetry path, use it first.
yield customPoetryPath;
}
} catch (ex) {
traceError(`Failed to get poetry setting`, ex);
}
// Check unqualified filename, in case it's on PATH.
yield 'poetry';
Expand Down