Skip to content
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

Fix behavior when missing Pip #6020

Merged
merged 9 commits into from
Jan 22, 2025
Prev Previous commit
Next Next commit
Updates prompt title in ProductInstaller when installing Pip
Also removes an unnecessary Positron overlay comment
samclark2015 committed Jan 17, 2025
commit ce88b5141350876d0613bf15c2799b4157d3843b
Original file line number Diff line number Diff line change
@@ -421,19 +421,37 @@ export class DataScienceInstaller extends BaseInstaller {
): Promise<InstallerResponse> {
// --- Start Positron ---
const productName = ProductNames.get(product)!;
const install = await positron.window.showSimpleModalDialogPrompt(
l10n.t('Install Python package "{0}"?', productName),
message ??
l10n.t(
'To enable Python support, Positron needs to install the package "{0}" for the active interpreter.',
productName,
),
l10n.t('Install'),
);

let hasPip = true;
if (_flags && _flags & ModuleInstallFlags.installPipIfRequired) {
const installer = this.serviceContainer.get<IInstaller>(IInstaller);
hasPip = await installer.isInstalled(Product.pip, resource);
}

let install;
if (hasPip) {
install = await positron.window.showSimpleModalDialogPrompt(
l10n.t('Install Python package "{0}"?', productName),
message ??
l10n.t(
'To enable Python support, Positron needs to install the package "{0}" for the active interpreter.',
productName,
),
l10n.t('Install'),
);
} else {
install = await positron.window.showSimpleModalDialogPrompt(
l10n.t('Install Python packages "{0}" and "{1}"?', ProductNames.get(Product.pip)!, productName),
message ??
l10n.t(
'To enable Python support, Positron needs to install the package "{0}" for the active interpreter.',
productName,
),
l10n.t('Install'),
);
}
if (install) {
// -- Start Positron --
return this.install(product, resource, cancel, _flags, options);
// -- End Positron --
}
// --- End Positron ---
return InstallerResponse.Ignore;