diff --git a/data/0.18.0/versionBundles.json b/data/0.18.0/versionBundles.json index 604cfea0..33f6ad1d 100644 --- a/data/0.18.0/versionBundles.json +++ b/data/0.18.0/versionBundles.json @@ -25,20 +25,35 @@ "cmake": "v3.29.9", "picotool": "2.1.0", "toolchain": "13_3_Rel1", - "riscvToolchain": "RISCV_RPI_2_0_0_5" + "riscvToolchain": "RISCV_RPI_2_0_0_5", + "modifiers": { + "darwin_x64": { + "toolchain": "13_2_Rel1" + } + } }, "2.1.1": { "ninja": "v1.12.1", "cmake": "v3.31.5", "picotool": "2.1.1", "toolchain": "14_2_Rel1", - "riscvToolchain": "RISCV_RPI_2_0_0_5" + "riscvToolchain": "RISCV_RPI_2_0_0_5", + "modifiers": { + "darwin_x64": { + "toolchain": "13_2_Rel1" + } + } }, "2.2.0": { "ninja": "v1.12.1", "cmake": "v3.31.5", "picotool": "2.2.0-a4", "toolchain": "14_2_Rel1", - "riscvToolchain": "RISCV_ZCB_RPI_2_1_1_3" + "riscvToolchain": "RISCV_ZCB_RPI_2_1_1_3", + "modifiers": { + "darwin_x64": { + "toolchain": "13_2_Rel1" + } + } } } diff --git a/src/utils/versionBundles.mts b/src/utils/versionBundles.mts index ae210c27..e5cade02 100644 --- a/src/utils/versionBundles.mts +++ b/src/utils/versionBundles.mts @@ -10,16 +10,12 @@ const versionBundlesUrl = `${CURRENT_DATA_VERSION}/versionBundles.json`; export interface VersionBundle { - python: { - version: string; - macos: string; - windowsAmd64: string; - }; ninja: string; cmake: string; picotool: string; toolchain: string; riscvToolchain: string; + modifiers: { [triple: string] : {[tool: string]: string}}; } export interface VersionBundles { @@ -103,24 +99,32 @@ export default class VersionBundlesLoader { await this.loadBundles(); } - return (this.bundles ?? {})[version]; - } + const chosenBundle = (this.bundles ?? {})[version]; - public async getPythonWindowsAmd64Url( - pythonVersion: string - ): Promise { - if (this.bundles === undefined) { - await this.loadBundles(); - } - if (this.bundles === undefined) { - return undefined; - } + if (chosenBundle !== undefined) { + const modifiers = chosenBundle?.modifiers; + if (modifiers !== undefined) { + const platformDouble = `${process.platform}_${process.arch}`; + if (modifiers[platformDouble] !== undefined) { + chosenBundle.cmake = + modifiers[platformDouble]["cmake"] ?? chosenBundle.cmake + + chosenBundle.ninja = + modifiers[platformDouble]["ninja"] ?? chosenBundle.ninja + + chosenBundle.picotool = + modifiers[platformDouble]["picotool"] ?? chosenBundle.picotool - const bundle = Object.values(this.bundles).find( - bundle => bundle.python.version === pythonVersion - ); + chosenBundle.toolchain = + modifiers[platformDouble]["toolchain"] ?? chosenBundle.toolchain + + chosenBundle.riscvToolchain = + modifiers[platformDouble]["riscvToolchain"] ?? + chosenBundle.riscvToolchain + } + } + } - //return bundle?.python.windowsAmd64; - return bundle; + return chosenBundle; } }