From cb0e07d80e6329dc941a4fdf7814a7c8720096de Mon Sep 17 00:00:00 2001 From: Aparna Jyothi Date: Wed, 19 Feb 2025 16:31:47 +0530 Subject: [PATCH] logic update --- dist/setup/index.js | 9 +++++++-- src/find-python.ts | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index e303bf05..69415049 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -99609,9 +99609,14 @@ 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)) && architecture !== 'x64') { + if (major > 3 || (major === 3 && minor >= 10)) { // For Python >= 3.10 and architecture!= 'x64', add the architecture-specific folder to the path - const arch = architecture === '32'; + let arch = ''; + // Check for x32 or x86 and append the '-32' suffix + // 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-64 or Python310-32) 'Scripts'); // Add the dynamically constructed path to the environment PATH variable diff --git a/src/find-python.ts b/src/find-python.ts index a859e1e5..d6d3ba61 100644 --- a/src/find-python.ts +++ b/src/find-python.ts @@ -139,9 +139,14 @@ export async function useCpythonVersion( const major = semver.major(version); const minor = semver.minor(version); - if ((major > 3 || (major === 3 && minor >= 10)) && architecture !== 'x64') { + if (major > 3 || (major === 3 && minor >= 10)) { // For Python >= 3.10 and architecture!= 'x64', add the architecture-specific folder to the path - const arch = architecture === '32'; + let arch = ''; + // Check for x32 or x86 and append the '-32' suffix + // 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'] || '',