mirror of
https://code.forgejo.org/actions/setup-python
synced 2025-06-08 04:18:19 +02:00
code update for free threaded
This commit is contained in:
parent
68111ac40e
commit
114b4684b8
2 changed files with 36 additions and 34 deletions
26
dist/setup/index.js
vendored
26
dist/setup/index.js
vendored
|
@ -96883,25 +96883,25 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
|
|||
core.addPath(installDir);
|
||||
core.addPath(_binDir);
|
||||
if (utils_1.IS_WINDOWS) {
|
||||
// Add --user directory
|
||||
const version = path.basename(path.dirname(installDir));
|
||||
const major = semver.major(version);
|
||||
const minor = semver.minor(version);
|
||||
if (major > 3 || (major === 3 && minor >= 10)) {
|
||||
// Handle Python >= 3.10
|
||||
const isFreeThreaded = core.getBooleanInput('freethreaded');
|
||||
const arch = architecture === 'x86' ? '-32' : '';
|
||||
const baseName = `Python${major}${minor}${isFreeThreaded ? 't' : ''}${arch}`;
|
||||
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', baseName, 'Scripts');
|
||||
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
|
||||
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}-${arch}`, 'Scripts');
|
||||
core.addPath(userScriptsDir);
|
||||
}
|
||||
else {
|
||||
// Handle Python < 3.10
|
||||
const isFreeThreaded = core.getBooleanInput('freethreaded');
|
||||
const suffix = isFreeThreaded ? 't' : '';
|
||||
const baseName = `Python${major}${minor}${suffix}`;
|
||||
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', baseName, 'Scripts');
|
||||
core.addPath(pythonPath);
|
||||
// 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');
|
||||
core.addPath(userScriptsDir);
|
||||
}
|
||||
// Dynamically handle case for Python314t
|
||||
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}t`, 'Scripts');
|
||||
core.addPath(pythonPath);
|
||||
}
|
||||
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
|
||||
}
|
||||
|
|
|
@ -152,43 +152,45 @@ export async function useCpythonVersion(
|
|||
core.addPath(_binDir);
|
||||
|
||||
if (IS_WINDOWS) {
|
||||
// Add --user directory
|
||||
const version = path.basename(path.dirname(installDir));
|
||||
const major = semver.major(version);
|
||||
const minor = semver.minor(version);
|
||||
|
||||
if (major > 3 || (major === 3 && minor >= 10)) {
|
||||
// Handle Python >= 3.10
|
||||
const isFreeThreaded = core.getBooleanInput('freethreaded');
|
||||
const arch = architecture === 'x86' ? '-32' : '';
|
||||
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
|
||||
|
||||
const baseName = `Python${major}${minor}${
|
||||
isFreeThreaded ? 't' : ''
|
||||
}${arch}`;
|
||||
|
||||
const pythonPath = path.join(
|
||||
const userScriptsDir = path.join(
|
||||
process.env['APPDATA'] || '',
|
||||
'Python',
|
||||
baseName,
|
||||
`Python${major}${minor}-${arch}`,
|
||||
'Scripts'
|
||||
);
|
||||
|
||||
core.addPath(pythonPath);
|
||||
core.addPath(userScriptsDir);
|
||||
} else {
|
||||
// Handle Python < 3.10
|
||||
const isFreeThreaded = core.getBooleanInput('freethreaded');
|
||||
const suffix = isFreeThreaded ? 't' : '';
|
||||
const baseName = `Python${major}${minor}${suffix}`;
|
||||
// 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'
|
||||
);
|
||||
core.addPath(userScriptsDir);
|
||||
}
|
||||
|
||||
// Dynamically handle case for Python314t
|
||||
const pythonPath = path.join(
|
||||
process.env['APPDATA'] || '',
|
||||
'Python',
|
||||
baseName,
|
||||
`Python${major}${minor}t`,
|
||||
'Scripts'
|
||||
);
|
||||
|
||||
core.addPath(pythonPath);
|
||||
}
|
||||
}
|
||||
// On Linux and macOS, pip will create the --user directory and add it to PATH as needed.
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue