@@ -10,16 +10,12 @@ const versionBundlesUrl =
10
10
`${ CURRENT_DATA_VERSION } /versionBundles.json` ;
11
11
12
12
export interface VersionBundle {
13
- python : {
14
- version : string ;
15
- macos : string ;
16
- windowsAmd64 : string ;
17
- } ;
18
13
ninja : string ;
19
14
cmake : string ;
20
15
picotool : string ;
21
16
toolchain : string ;
22
17
riscvToolchain : string ;
18
+ modifiers : { [ triple : string ] : { [ tool : string ] : string } } ;
23
19
}
24
20
25
21
export interface VersionBundles {
@@ -103,24 +99,32 @@ export default class VersionBundlesLoader {
103
99
await this . loadBundles ( ) ;
104
100
}
105
101
106
- return ( this . bundles ?? { } ) [ version ] ;
107
- }
102
+ const chosenBundle = ( this . bundles ?? { } ) [ version ] ;
108
103
109
- public async getPythonWindowsAmd64Url (
110
- pythonVersion : string
111
- ) : Promise < VersionBundle | undefined > {
112
- if ( this . bundles === undefined ) {
113
- await this . loadBundles ( ) ;
114
- }
115
- if ( this . bundles === undefined ) {
116
- return undefined ;
117
- }
104
+ if ( chosenBundle !== undefined ) {
105
+ const modifiers = chosenBundle ?. modifiers ;
106
+ if ( modifiers !== undefined ) {
107
+ const platformDouble = `${ process . platform } _${ process . arch } ` ;
108
+ if ( modifiers [ platformDouble ] !== undefined ) {
109
+ chosenBundle . cmake =
110
+ modifiers [ platformDouble ] [ "cmake" ] ?? chosenBundle . cmake
111
+
112
+ chosenBundle . ninja =
113
+ modifiers [ platformDouble ] [ "ninja" ] ?? chosenBundle . ninja
114
+
115
+ chosenBundle . picotool =
116
+ modifiers [ platformDouble ] [ "picotool" ] ?? chosenBundle . picotool
118
117
119
- const bundle = Object . values ( this . bundles ) . find (
120
- bundle => bundle . python . version === pythonVersion
121
- ) ;
118
+ chosenBundle . toolchain =
119
+ modifiers [ platformDouble ] [ "toolchain" ] ?? chosenBundle . toolchain
120
+
121
+ chosenBundle . riscvToolchain =
122
+ modifiers [ platformDouble ] [ "riscvToolchain" ] ??
123
+ chosenBundle . riscvToolchain
124
+ }
125
+ }
126
+ }
122
127
123
- //return bundle?.python.windowsAmd64;
124
- return bundle ;
128
+ return chosenBundle ;
125
129
}
126
130
}
0 commit comments