mirror of
https://github.com/actions/setup-python.git
synced 2025-04-24 07:22:14 +00:00
condition update
This commit is contained in:
parent
850fba7b6d
commit
8d977bc936
2 changed files with 11 additions and 15 deletions
11
dist/setup/index.js
vendored
11
dist/setup/index.js
vendored
|
@ -99609,14 +99609,11 @@ 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);
|
||||||
if (major > 3 || (major === 3 && minor >= 10)) {
|
if (architecture === 'x86' &&
|
||||||
|
(major > 3 || (major === 3 && minor >= 10))) {
|
||||||
// For Python >= 3.10 and architecture!= 'x64', add the architecture-specific folder to the path
|
// For Python >= 3.10 and architecture!= 'x64', add the architecture-specific folder to the path
|
||||||
let arch = '';
|
let arch = '32';
|
||||||
// Check for x32 or x86 and append the '-32' suffix
|
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}-${arch}`, // Add architecture-specific folder (e.g., Python310 or Python310-32)
|
||||||
if (architecture === 'x32' || architecture === 'x86') {
|
|
||||||
arch = `-32`; // Always add '-32' for both x32 and x86 architectures
|
|
||||||
}
|
|
||||||
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}${arch}`, // Add architecture-specific folder (e.g., Python310 or Python310-32)
|
|
||||||
'Scripts');
|
'Scripts');
|
||||||
// Add the dynamically constructed path to the environment PATH variable
|
// Add the dynamically constructed path to the environment PATH variable
|
||||||
core.addPath(userScriptsDir);
|
core.addPath(userScriptsDir);
|
||||||
|
|
|
@ -139,19 +139,17 @@ export async function useCpythonVersion(
|
||||||
const major = semver.major(version);
|
const major = semver.major(version);
|
||||||
const minor = semver.minor(version);
|
const minor = semver.minor(version);
|
||||||
|
|
||||||
if (major > 3 || (major === 3 && minor >= 10)) {
|
if (
|
||||||
|
architecture === 'x86' &&
|
||||||
|
(major > 3 || (major === 3 && minor >= 10))
|
||||||
|
) {
|
||||||
// For Python >= 3.10 and architecture!= 'x64', add the architecture-specific folder to the path
|
// For Python >= 3.10 and architecture!= 'x64', add the architecture-specific folder to the path
|
||||||
let arch = '';
|
let arch = '32';
|
||||||
|
|
||||||
// Check for x32 or x86 and append the '-32' suffix
|
|
||||||
if (architecture === 'x32' || architecture === 'x86') {
|
|
||||||
arch = `-32`; // Always add '-32' for both x32 and x86 architectures
|
|
||||||
}
|
|
||||||
|
|
||||||
const userScriptsDir = path.join(
|
const userScriptsDir = path.join(
|
||||||
process.env['APPDATA'] || '',
|
process.env['APPDATA'] || '',
|
||||||
'Python',
|
'Python',
|
||||||
`Python${major}${minor}${arch}`, // Add architecture-specific folder (e.g., Python310 or Python310-32)
|
`Python${major}${minor}-${arch}`, // Add architecture-specific folder (e.g., Python310 or Python310-32)
|
||||||
'Scripts'
|
'Scripts'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -159,6 +157,7 @@ export async function useCpythonVersion(
|
||||||
core.addPath(userScriptsDir);
|
core.addPath(userScriptsDir);
|
||||||
} else {
|
} else {
|
||||||
// For Python < 3.10, add the default path without architecture-specific folder as per the official installer path
|
// For Python < 3.10, add the default path without architecture-specific folder as per the official installer path
|
||||||
|
|
||||||
const userScriptsDir = path.join(
|
const userScriptsDir = path.join(
|
||||||
process.env['APPDATA'] || '',
|
process.env['APPDATA'] || '',
|
||||||
'Python',
|
'Python',
|
||||||
|
|
Loading…
Add table
Reference in a new issue