Skip to content

Commit f6c279b

Browse files
committed
Add modifiers to version bundles
Allows modifying versions of tools for specific platforms, for example use 13.2.Rel1 toolchain instead of 13.3.Rel1 on Intel MacOS, as 13.3.Rel1 is linked against homebrew (https://forums.raspberrypi.com/viewtopic.php?t=380395)
1 parent 708db93 commit f6c279b

File tree

2 files changed

+34
-25
lines changed

2 files changed

+34
-25
lines changed

data/0.18.0/versionBundles.json

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,35 @@
2525
"cmake": "v3.29.9",
2626
"picotool": "2.1.0",
2727
"toolchain": "13_3_Rel1",
28-
"riscvToolchain": "RISCV_RPI_2_0_0_5"
28+
"riscvToolchain": "RISCV_RPI_2_0_0_5",
29+
"modifiers": {
30+
"darwin_x64": {
31+
"toolchain": "13_2_Rel1"
32+
}
33+
}
2934
},
3035
"2.1.1": {
3136
"ninja": "v1.12.1",
3237
"cmake": "v3.31.5",
3338
"picotool": "2.1.1",
3439
"toolchain": "14_2_Rel1",
35-
"riscvToolchain": "RISCV_RPI_2_0_0_5"
40+
"riscvToolchain": "RISCV_RPI_2_0_0_5",
41+
"modifiers": {
42+
"darwin_x64": {
43+
"toolchain": "13_2_Rel1"
44+
}
45+
}
3646
},
3747
"2.2.0": {
3848
"ninja": "v1.12.1",
3949
"cmake": "v3.31.5",
4050
"picotool": "2.2.0-a4",
4151
"toolchain": "14_2_Rel1",
42-
"riscvToolchain": "RISCV_ZCB_RPI_2_1_1_3"
52+
"riscvToolchain": "RISCV_ZCB_RPI_2_1_1_3",
53+
"modifiers": {
54+
"darwin_x64": {
55+
"toolchain": "13_2_Rel1"
56+
}
57+
}
4358
}
4459
}

src/utils/versionBundles.mts

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,12 @@ const versionBundlesUrl =
1010
`${CURRENT_DATA_VERSION}/versionBundles.json`;
1111

1212
export 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

2521
export interface VersionBundles {
@@ -103,24 +99,22 @@ export default class VersionBundlesLoader {
10399
await this.loadBundles();
104100
}
105101

106-
return (this.bundles ?? {})[version];
107-
}
108-
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;
102+
const chosenBundle = (this.bundles ?? {})[version];
103+
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 = modifiers[platformDouble]["cmake"] ?? chosenBundle.cmake
110+
chosenBundle.ninja = modifiers[platformDouble]["ninja"] ?? chosenBundle.ninja
111+
chosenBundle.picotool = modifiers[platformDouble]["picotool"] ?? chosenBundle.picotool
112+
chosenBundle.toolchain = modifiers[platformDouble]["toolchain"] ?? chosenBundle.toolchain
113+
chosenBundle.riscvToolchain = modifiers[platformDouble]["riscvToolchain"] ?? chosenBundle.riscvToolchain
114+
}
115+
}
117116
}
118117

119-
const bundle = Object.values(this.bundles).find(
120-
bundle => bundle.python.version === pythonVersion
121-
);
122-
123-
//return bundle?.python.windowsAmd64;
124-
return bundle;
118+
return chosenBundle;
125119
}
126120
}

0 commit comments

Comments
 (0)