update the install path for free-threaded

This commit is contained in:
Aparna Jyothi 2025-03-25 11:05:31 +05:30
parent feb0ff9aba
commit da4451310f
2 changed files with 48 additions and 19 deletions

19
dist/setup/index.js vendored
View file

@ -99613,18 +99613,29 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
(major > 3 || (major === 3 && minor >= 10))) { (major > 3 || (major === 3 && minor >= 10))) {
// For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path // For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path
const arch = '32'; // Only for x86 architecture const arch = '32'; // Only for x86 architecture
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}-${arch}`, 'Scripts'); const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}-${arch}`, 'Scripts');
core.addPath(userScriptsDir); core.addPath(pythonPath);
} }
else { else {
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path // For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts'); const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
core.addPath(userScriptsDir); core.addPath(pythonPath);
} }
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'; // Only for x86 architecture
// Dynamically handle case for Python314t
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}t--${arch}`, 'Scripts');
core.addPath(pythonPath);
}
else {
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
// Dynamically handle case for Python314t // Dynamically handle case for Python314t
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}t`, 'Scripts'); const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}t`, 'Scripts');
core.addPath(pythonPath); core.addPath(pythonPath);
} }
}
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed. // On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
} }
const installed = versionFromPath(installDir); const installed = versionFromPath(installDir);

View file

@ -146,24 +146,41 @@ export async function useCpythonVersion(
// For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path // For Python >= 3.10 and architecture='x86', add the architecture-specific folder to the path
const arch = '32'; // Only for x86 architecture const arch = '32'; // Only for x86 architecture
const userScriptsDir = path.join( const pythonPath = path.join(
process.env['APPDATA'] || '', process.env['APPDATA'] || '',
'Python', 'Python',
`Python${major}${minor}-${arch}`, `Python${major}${minor}-${arch}`,
'Scripts' 'Scripts'
); );
core.addPath(userScriptsDir); core.addPath(pythonPath);
} else { } else {
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path // For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
const userScriptsDir = path.join( const pythonPath = path.join(
process.env['APPDATA'] || '', process.env['APPDATA'] || '',
'Python', 'Python',
`Python${major}${minor}`, `Python${major}${minor}`,
'Scripts' 'Scripts'
); );
core.addPath(userScriptsDir); core.addPath(pythonPath);
} }
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'; // Only for x86 architecture
// Dynamically handle case for Python314t
const pythonPath = path.join(
process.env['APPDATA'] || '',
'Python',
`Python${major}${minor}t--${arch}`,
'Scripts'
);
core.addPath(pythonPath);
} else {
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
// Dynamically handle case for Python314t // Dynamically handle case for Python314t
const pythonPath = path.join( const pythonPath = path.join(
process.env['APPDATA'] || '', process.env['APPDATA'] || '',
@ -173,6 +190,7 @@ export async function useCpythonVersion(
); );
core.addPath(pythonPath); core.addPath(pythonPath);
} }
}
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed. // On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
} }