Skip to content
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
13 changes: 4 additions & 9 deletions src/managers/poetry/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Disposable, l10n, LogOutputChannel } from 'vscode';
import { Disposable, LogOutputChannel } from 'vscode';
import { PythonEnvironmentApi } from '../../api';
import { traceInfo } from '../../common/logging';
import { showErrorMessage } from '../../common/window.apis';
import { getPythonApi } from '../../features/pythonApi';
import { NativePythonFinder } from '../common/nativePythonFinder';
import { PoetryManager } from './poetryManager';
Expand All @@ -18,15 +17,11 @@ export async function registerPoetryFeatures(
try {
const poetryPath = await getPoetry(nativeFinder);
if (poetryPath) {
const version = await getPoetryVersion(poetryPath);
if (!version) {
showErrorMessage(l10n.t('Poetry version could not be determined.'));
return;
}
traceInfo(
'The `shell` command is not available by default in Poetry versions 2.0.0 and above. Therefore all shell activation will be handled by calling `source <path-to-activate>`. If you face any problems with shell activation, please file an issue at https://github.com/microsoft/vscode-python-environments/issues to help us improve this implementation. Note the current version of Poetry is {0}.',
version,
'The `shell` command is not available by default in Poetry versions 2.0.0 and above. Therefore all shell activation will be handled by calling `source <path-to-activate>`. If you face any problems with shell activation, please file an issue at https://github.com/microsoft/vscode-python-environments/issues to help us improve this implementation.',
);
const version = await getPoetryVersion(poetryPath);
traceInfo(`Poetry found at ${poetryPath}, version: ${version}`);
const envManager = new PoetryManager(nativeFinder, api);
const pkgManager = new PoetryPackageManager(api, outputChannel, envManager);

Expand Down
1 change: 1 addition & 0 deletions src/managers/poetry/poetryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export async function getPoetryVersion(poetry: string): Promise<string | undefin
// Handle both formats:
// Old: "Poetry version 1.5.1"
// New: "Poetry (version 2.1.3)"
traceInfo(`Poetry version output: ${stdout.trim()}`);
const match = stdout.match(/Poetry (?:version|[\(\s]+version[\s\)]+)([0-9]+\.[0-9]+\.[0-9]+)/i);
return match ? match[1] : undefined;
} catch {
Expand Down