File tree Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Expand file tree Collapse file tree 3 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ import {
19
19
getBundledPythonPath ,
20
20
getEnvironmentPath ,
21
21
getUserHomeDir ,
22
- isPortInUse
22
+ isPortInUse ,
23
+ versionWithoutSuffix
23
24
} from './utils' ;
24
25
import { SettingType , userSettings } from './config/settings' ;
25
26
import { appData } from './config/appdata' ;
@@ -779,13 +780,10 @@ export class Registry implements IRegistry, IDisposable {
779
780
return requirements . every ( ( req , index , reqSelf ) => {
780
781
try {
781
782
const version = environment . versions [ req . name ] ;
782
- // remove alpha / beta suffixes
783
- const versionWithoutSuffix = `${ semver . major ( version , {
784
- loose : true
785
- } ) } .${ semver . minor ( version , {
786
- loose : true
787
- } ) } .${ semver . patch ( version , { loose : true } ) } `;
788
- return semver . satisfies ( versionWithoutSuffix , req . versionRange ) ;
783
+ return semver . satisfies (
784
+ versionWithoutSuffix ( version ) ,
785
+ req . versionRange
786
+ ) ;
789
787
} catch ( e ) {
790
788
return false ;
791
789
}
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import * as ejs from 'ejs';
5
5
import { app , BrowserWindow } from 'electron' ;
6
6
import * as path from 'path' ;
7
7
import * as fs from 'fs' ;
8
- const semver = require ( 'semver' ) ;
9
8
import { ThemedWindow } from '../dialog/themedwindow' ;
10
9
import {
11
10
CtrlWBehavior ,
@@ -16,7 +15,7 @@ import {
16
15
StartupMode ,
17
16
ThemeType
18
17
} from '../config/settings' ;
19
- import { getBundledPythonPath } from '../utils' ;
18
+ import { getBundledPythonPath , versionWithoutSuffix } from '../utils' ;
20
19
import { IRegistry } from '../registry' ;
21
20
22
21
export class SettingsDialog {
@@ -69,8 +68,10 @@ export class SettingsDialog {
69
68
const bundledEnv = registry . getEnvironmentByPath ( bundledPythonPath ) ;
70
69
const jlabVersion = bundledEnv . versions [ 'jupyterlab' ] ;
71
70
const appVersion = app . getVersion ( ) ;
72
- const diff = semver . diff ( appVersion , jlabVersion ) ;
73
- if ( diff !== 'prerelease' ) {
71
+
72
+ if (
73
+ versionWithoutSuffix ( jlabVersion ) !== versionWithoutSuffix ( appVersion )
74
+ ) {
74
75
bundledEnvInstallationLatest = false ;
75
76
}
76
77
} catch ( error ) {
Original file line number Diff line number Diff line change 3
3
4
4
import * as path from 'path' ;
5
5
import * as fs from 'fs' ;
6
+ import * as semver from 'semver' ;
6
7
import log from 'electron-log' ;
7
8
import { AddressInfo , createServer , Socket } from 'net' ;
8
9
import { app , nativeTheme } from 'electron' ;
@@ -230,3 +231,10 @@ export async function waitForFunction(
230
231
}
231
232
} ) ;
232
233
}
234
+
235
+ // remove alpha / beta suffixes
236
+ export function versionWithoutSuffix ( version : string ) {
237
+ return `${ semver . major ( version , { loose : true } ) } .${ semver . minor ( version , {
238
+ loose : true
239
+ } ) } .${ semver . patch ( version , { loose : true } ) } `;
240
+ }
You can’t perform that action at this time.
0 commit comments