update-install path --user flag for x86 for >=3.10

This commit is contained in:
Aparna Jyothi 2025-02-19 18:42:54 +05:30
parent 6ca8e8598f
commit bd89e34f27
2 changed files with 37 additions and 9 deletions

12
dist/setup/index.js vendored
View File

@ -99611,9 +99611,19 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
const version = path.basename(path.dirname(installDir));
const major = semver.major(version);
const minor = semver.minor(version);
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
if (architecture === 'x86' &&
(major > 3 || (major === 3 && minor >= 10))) {
// For Python >= 3.10 and architecture= 'x86', add the architecture-specific folder to the path
const arch = '32';
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}-${arch}`, 'Scripts');
core.addPath(userScriptsDir);
}
else {
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
// Add the default path to the environment PATH variable
core.addPath(userScriptsDir);
}
}
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
}
const installed = versionFromPath(installDir);

View File

@ -141,14 +141,32 @@ export async function useCpythonVersion(
const major = semver.major(version);
const minor = semver.minor(version);
if (
architecture === 'x86' &&
(major > 3 || (major === 3 && minor >= 10))
) {
// For Python >= 3.10 and architecture= 'x86', add the architecture-specific folder to the path
const arch = '32';
const userScriptsDir = path.join(
process.env['APPDATA'] || '',
'Python',
`Python${major}${minor}-${arch}`,
'Scripts'
);
core.addPath(userScriptsDir);
} else {
const userScriptsDir = path.join(
process.env['APPDATA'] || '',
'Python',
`Python${major}${minor}`,
'Scripts'
);
// Add the default path to the environment PATH variable
core.addPath(userScriptsDir);
}
}
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
}