From 8d977bc9362c3ee4d5a5077d7a3b73d77a338324 Mon Sep 17 00:00:00 2001 From: Aparna Jyothi Date: Wed, 19 Feb 2025 18:02:26 +0530 Subject: [PATCH] condition update --- dist/setup/index.js | 11 ++++------- src/find-python.ts | 15 +++++++-------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 01d4e3cc..77c09128 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -99609,14 +99609,11 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest const version = path.basename(path.dirname(installDir)); const major = semver.major(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 - let arch = ''; - // 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(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}${arch}`, // Add architecture-specific folder (e.g., Python310 or Python310-32) + let arch = '32'; + const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}-${arch}`, // Add architecture-specific folder (e.g., Python310 or Python310-32) 'Scripts'); // Add the dynamically constructed path to the environment PATH variable core.addPath(userScriptsDir); diff --git a/src/find-python.ts b/src/find-python.ts index 1a9e94d4..960ce6ae 100644 --- a/src/find-python.ts +++ b/src/find-python.ts @@ -139,19 +139,17 @@ export async function useCpythonVersion( const major = semver.major(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 - let arch = ''; - - // 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 - } + let arch = '32'; const userScriptsDir = path.join( process.env['APPDATA'] || '', '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' ); @@ -159,6 +157,7 @@ export async function useCpythonVersion( core.addPath(userScriptsDir); } else { // For Python < 3.10, add the default path without architecture-specific folder as per the official installer path + const userScriptsDir = path.join( process.env['APPDATA'] || '', 'Python',