3
3
4
4
import { IFileSystem , IPlatformService } from '../common/platform/types' ;
5
5
import {
6
- analysis_engine_centos_x64_sha512 ,
7
- analysis_engine_debian_x64_sha512 ,
8
- analysis_engine_fedora_x64_sha512 ,
9
- analysis_engine_ol_x64_sha512 ,
10
- analysis_engine_opensuse_x64_sha512 ,
6
+ analysis_engine_linux_x64_sha512 ,
11
7
analysis_engine_osx_x64_sha512 ,
12
- analysis_engine_rhel_x64_sha512 ,
13
- analysis_engine_ubuntu_x64_sha512 ,
14
8
analysis_engine_win_x64_sha512 ,
15
9
analysis_engine_win_x86_sha512
16
10
} from './analysisEngineHashes' ;
17
11
18
- // '/etc/os-release', ID=flavor
19
- const supportedLinuxFlavors = [
20
- 'centos' ,
21
- 'debian' ,
22
- 'fedora' ,
23
- 'ol' ,
24
- 'opensuse' ,
25
- 'rhel' ,
26
- 'ubuntu'
27
- ] ;
28
-
29
12
export class PlatformData {
30
- constructor ( private platform : IPlatformService , private fs : IFileSystem ) { }
13
+ constructor ( private platform : IPlatformService , fs : IFileSystem ) { }
31
14
public async getPlatformName ( ) : Promise < string > {
32
15
if ( this . platform . isWindows ) {
33
16
return this . platform . is64bit ? 'win-x64' : 'win-x86' ;
@@ -39,14 +22,7 @@ export class PlatformData {
39
22
if ( ! this . platform . is64bit ) {
40
23
throw new Error ( 'Python Analysis Engine does not support 32-bit Linux.' ) ;
41
24
}
42
- const linuxFlavor = await this . getLinuxFlavor ( ) ;
43
- if ( linuxFlavor . length === 0 ) {
44
- throw new Error ( 'Unable to determine Linux flavor from /etc/os-release.' ) ;
45
- }
46
- if ( supportedLinuxFlavors . indexOf ( linuxFlavor ) < 0 ) {
47
- throw new Error ( `${ linuxFlavor } is not supported.` ) ;
48
- }
49
- return `${ linuxFlavor } -x64` ;
25
+ return 'linux-x64' ;
50
26
}
51
27
throw new Error ( 'Unknown OS platform.' ) ;
52
28
}
@@ -58,7 +34,7 @@ export class PlatformData {
58
34
public getEngineExecutableName ( ) : string {
59
35
return this . platform . isWindows
60
36
? 'Microsoft.PythonTools.VsCode.exe'
61
- : 'Microsoft.PythonTools.VsCode' ;
37
+ : 'Microsoft.PythonTools.VsCode.VsCode ' ;
62
38
}
63
39
64
40
public async getExpectedHash ( ) : Promise < string > {
@@ -69,30 +45,8 @@ export class PlatformData {
69
45
return analysis_engine_osx_x64_sha512 ;
70
46
}
71
47
if ( this . platform . isLinux && this . platform . is64bit ) {
72
- const linuxFlavor = await this . getLinuxFlavor ( ) ;
73
- // tslint:disable-next-line:switch-default
74
- switch ( linuxFlavor ) {
75
- case 'centos' : return analysis_engine_centos_x64_sha512 ;
76
- case 'debian' : return analysis_engine_debian_x64_sha512 ;
77
- case 'fedora' : return analysis_engine_fedora_x64_sha512 ;
78
- case 'ol' : return analysis_engine_ol_x64_sha512 ;
79
- case 'opensuse' : return analysis_engine_opensuse_x64_sha512 ;
80
- case 'rhel' : return analysis_engine_rhel_x64_sha512 ;
81
- case 'ubuntu' : return analysis_engine_ubuntu_x64_sha512 ;
82
- }
48
+ return analysis_engine_linux_x64_sha512 ;
83
49
}
84
50
throw new Error ( 'Unknown platform.' ) ;
85
51
}
86
-
87
- private async getLinuxFlavor ( ) : Promise < string > {
88
- const verFile = '/etc/os-release' ;
89
- const data = await this . fs . readFile ( verFile ) ;
90
- if ( data ) {
91
- const res = / I D = ( .* ) / . exec ( data ) ;
92
- if ( res && res . length > 1 ) {
93
- return res [ 1 ] ;
94
- }
95
- }
96
- return '' ;
97
- }
98
52
}
0 commit comments