Skip prompting for package upgrade if a python install is already in progress. (#7717)

This commit is contained in:
Cory Rivera
2019-10-14 15:31:53 -07:00
committed by GitHub
parent 26ece1ee86
commit eb465fde1a

View File

@@ -34,6 +34,7 @@ const msgInstallPkgFinish = localize('msgInstallPkgFinish', "Notebook dependenci
const msgPythonRunningError = localize('msgPythonRunningError', "Cannot overwrite an existing Python installation while python is running. Please close any active notebooks before proceeding.");
const msgPendingInstallError = localize('msgPendingInstallError', "Another Python installation is currently in progress.");
const msgSkipPythonInstall = localize('msgSkipPythonInstall', "Python already exists at the specific location. Skipping install.");
const msgSkippedPackageUpgrade = localize('msgSkippedPackageUpgrade', "Skipping notebook package upgrade since another Python install is currently in progress.");
function msgDependenciesInstallationFailed(errorMessage: string): string { return localize('msgDependenciesInstallationFailed', "Installing Notebook dependencies failed with error: {0}", errorMessage); }
function msgDownloadPython(platform: string, pythonDownloadUrl: string): string { return localize('msgDownloadPython', "Downloading local python for platform: {0} to {1}", platform, pythonDownloadUrl); }
@@ -388,8 +389,18 @@ export class JupyterServerInstallation {
/**
* Prompts user to upgrade certain python packages if they're below the minimum expected version.
*/
public promptForPackageUpgrade(): Promise<void> {
return this.upgradePythonPackages(true, false);
public async promptForPackageUpgrade(): Promise<void> {
if (this._installInProgress) {
this.apiWrapper.showInfoMessage(msgSkippedPackageUpgrade);
return;
}
this._installInProgress = true;
try {
await this.upgradePythonPackages(true, false);
} finally {
this._installInProgress = false;
}
}
private async upgradePythonPackages(promptForUpgrade: boolean, forceInstall: boolean): Promise<void> {