Improve error message when trying to use free threaded Python versions before 3.13

This commit is contained in:
Sam Gross 2025-02-14 17:26:31 +00:00
parent 197140633c
commit 0681a6bff7
2 changed files with 23 additions and 13 deletions

12
dist/setup/index.js vendored
View File

@ -91073,12 +91073,16 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
} }
if (!installDir) { if (!installDir) {
const osInfo = yield (0, utils_1.getOSInfo)(); const osInfo = yield (0, utils_1.getOSInfo)();
throw new Error([ const msg = [
`The version '${version}' with architecture '${architecture}' was not found for ${osInfo `The version '${version}' with architecture '${architecture}' was not found for ${osInfo
? `${osInfo.osName} ${osInfo.osVersion}` ? `${osInfo.osName} ${osInfo.osVersion}`
: 'this operating system'}.`, : 'this operating system'}.`
`The list of all available versions can be found here: ${installer.MANIFEST_URL}` ];
].join(os.EOL)); if (freethreaded) {
msg.push(`Free threaded versions are only available for Python 3.13.0 and later.`);
}
msg.push(`The list of all available versions can be found here: ${installer.MANIFEST_URL}`);
throw new Error(msg.join(os.EOL));
} }
const _binDir = binDir(installDir); const _binDir = binDir(installDir);
const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : ''; const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';

View File

@ -102,16 +102,22 @@ export async function useCpythonVersion(
if (!installDir) { if (!installDir) {
const osInfo = await getOSInfo(); const osInfo = await getOSInfo();
throw new Error( const msg = [
[ `The version '${version}' with architecture '${architecture}' was not found for ${
`The version '${version}' with architecture '${architecture}' was not found for ${ osInfo
osInfo ? `${osInfo.osName} ${osInfo.osVersion}`
? `${osInfo.osName} ${osInfo.osVersion}` : 'this operating system'
: 'this operating system' }.`
}.`, ];
`The list of all available versions can be found here: ${installer.MANIFEST_URL}` if (freethreaded) {
].join(os.EOL) msg.push(
`Free threaded versions are only available for Python 3.13.0 and later.`
);
}
msg.push(
`The list of all available versions can be found here: ${installer.MANIFEST_URL}`
); );
throw new Error(msg.join(os.EOL));
} }
const _binDir = binDir(installDir); const _binDir = binDir(installDir);