@@ -10,16 +10,12 @@ const versionBundlesUrl =
1010 `${ CURRENT_DATA_VERSION } /versionBundles.json` ;
1111
1212export interface VersionBundle {
13- python : {
14- version : string ;
15- macos : string ;
16- windowsAmd64 : string ;
17- } ;
1813 ninja : string ;
1914 cmake : string ;
2015 picotool : string ;
2116 toolchain : string ;
2217 riscvToolchain : string ;
18+ modifiers : { [ triple : string ] : { [ tool : string ] : string } } ;
2319}
2420
2521export interface VersionBundles {
@@ -103,24 +99,32 @@ export default class VersionBundlesLoader {
10399 await this . loadBundles ( ) ;
104100 }
105101
106- return ( this . bundles ?? { } ) [ version ] ;
107- }
102+ const chosenBundle = ( this . bundles ?? { } ) [ version ] ;
108103
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
118117
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+ }
122127
123- //return bundle?.python.windowsAmd64;
124- return bundle ;
128+ return chosenBundle ;
125129 }
126130}
0 commit comments