1
0
Fork 0
mirror of https://github.com/actions/setup-python.git synced 2025-06-08 06:27:00 +09:00

Added architecture validation validated for freethreaded related inputs

This commit is contained in:
Aparna Jyothi 2025-06-05 17:14:53 +05:30
parent 9d11fda211
commit b26f6d02db
2 changed files with 8 additions and 6 deletions

5
dist/setup/index.js vendored
View file

@ -96817,6 +96817,9 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
// Use the freethreaded version if it was specified in the input, e.g., 3.13t // Use the freethreaded version if it was specified in the input, e.g., 3.13t
freethreaded = true; freethreaded = true;
} }
if (architecture.endsWith('-freethreaded')) {
throw new Error(`Invalid architecture '${architecture}'. Use 'freethreaded' flag in the python-version (e.g., '3.13.1t') or - freethreaded: true instead of specifying '-freethreaded' in the architecture`);
}
core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`); core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`);
if (freethreaded) { if (freethreaded) {
// Free threaded versions use an architecture suffix like `x64-freethreaded` // Free threaded versions use an architecture suffix like `x64-freethreaded`
@ -96887,8 +96890,6 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
const version = path.basename(path.dirname(installDir)); const version = path.basename(path.dirname(installDir));
const major = semver.major(version); const major = semver.major(version);
const minor = semver.minor(version); const minor = semver.minor(version);
const freethreadedInput = core.getInput('freethreaded');
const freethreaded = freethreadedInput === 'true' || architecture.includes('freethreaded');
const basePath = process.env['APPDATA'] || ''; const basePath = process.env['APPDATA'] || '';
let versionSuffix = `${major}${minor}`; let versionSuffix = `${major}${minor}`;
// Append '-32' for x86 architecture if Python version is >= 3.10 // Append '-32' for x86 architecture if Python version is >= 3.10

View file

@ -49,8 +49,12 @@ export async function useCpythonVersion(
// Use the freethreaded version if it was specified in the input, e.g., 3.13t // Use the freethreaded version if it was specified in the input, e.g., 3.13t
freethreaded = true; freethreaded = true;
} }
if (architecture.endsWith('-freethreaded')) {
throw new Error(
`Invalid architecture '${architecture}'. Use 'freethreaded' flag in the python-version (e.g., '3.13.1t') or - freethreaded: true instead of specifying '-freethreaded' in the architecture`
);
}
core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`); core.debug(`Semantic version spec of ${version} is ${semanticVersionSpec}`);
if (freethreaded) { if (freethreaded) {
// Free threaded versions use an architecture suffix like `x64-freethreaded` // Free threaded versions use an architecture suffix like `x64-freethreaded`
core.debug(`Using freethreaded version of ${semanticVersionSpec}`); core.debug(`Using freethreaded version of ${semanticVersionSpec}`);
@ -156,9 +160,6 @@ export async function useCpythonVersion(
const version = path.basename(path.dirname(installDir)); const version = path.basename(path.dirname(installDir));
const major = semver.major(version); const major = semver.major(version);
const minor = semver.minor(version); const minor = semver.minor(version);
const freethreadedInput = core.getInput('freethreaded');
const freethreaded =
freethreadedInput === 'true' || architecture.includes('freethreaded');
const basePath = process.env['APPDATA'] || ''; const basePath = process.env['APPDATA'] || '';
let versionSuffix = `${major}${minor}`; let versionSuffix = `${major}${minor}`;