Files
makelore/scripts/bundled-python-manifest.mjs
2026-07-29 17:22:35 +08:00

52 lines
1.7 KiB
JavaScript

const RELEASE_BASE = 'https://github.com/astral-sh/python-build-standalone/releases/download';
const MIRROR_BASE = 'https://registry.npmmirror.com/-/binary/python-build-standalone';
export const PYTHON_VERSION = '3.12.13';
export const PYTHON_RELEASE = '20260510';
function target(triple, sha256, executable) {
const archiveName = `cpython-${PYTHON_VERSION}+${PYTHON_RELEASE}-${triple}-install_only_stripped.tar.gz`;
const encodedArchiveName = archiveName.replace('+', '%2B');
return Object.freeze({
archiveName,
url: `${RELEASE_BASE}/${PYTHON_RELEASE}/${encodedArchiveName}`,
mirrorUrl: `${MIRROR_BASE}/${PYTHON_RELEASE}/${archiveName}`,
sha256,
executable,
});
}
export const PYTHON_TARGETS = Object.freeze({
'darwin-arm64': target(
'aarch64-apple-darwin',
'55bc1a5edbc8ac4da0081f4f5731ed2d1ed10c57cb37a820b2a0dbc7cad742e9',
'python/bin/python3',
),
'darwin-x64': target(
'x86_64-apple-darwin',
'6bab7fa97d4f2ddba86da0e05acff66c53b5edaca1df8edcf00ddca785a9c59b',
'python/bin/python3',
),
'linux-arm64': target(
'aarch64-unknown-linux-gnu',
'8e2907baca8b08ae43f366e65f09fda6337d3543f322c399d8800cf689c79973',
'python/bin/python3',
),
'linux-x64': target(
'x86_64-unknown-linux-gnu',
'd480f5d5878910ecbae212bf23bd7c25d7b209eb8cf5e98823c977384d272e88',
'python/bin/python3',
),
'win32-x64': target(
'x86_64-pc-windows-msvc',
'24168aff2e7d93784c6a436124c4ebb79b076a4e289bde4902c08333507b71d0',
'python/python.exe',
),
});
export function getPythonTarget(id) {
const value = PYTHON_TARGETS[id];
if (!value) throw new Error(`Unsupported bundled Python target: ${id}`);
return value;
}