Compare commits

..

No commits in common. "da4451310f5845d04265284f923710bac33c7a1d" and "bd89e34f27ff277222b4907d05507663b0921436" have entirely different histories.

2 changed files with 18 additions and 54 deletions

30
dist/setup/index.js vendored
View file

@ -99606,34 +99606,22 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
core.addPath(_binDir);
if (utils_1.IS_WINDOWS) {
// Add --user directory
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
// So if `findLocalTool` succeeded above, we must have a conformant `installDir`
const version = path.basename(path.dirname(installDir));
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'; // Only for x86 architecture
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}-${arch}`, 'Scripts');
core.addPath(pythonPath);
// 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 {
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, '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
// 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
const pythonPath = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}t`, 'Scripts');
core.addPath(pythonPath);
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.

View file

@ -135,6 +135,8 @@ export async function useCpythonVersion(
if (IS_WINDOWS) {
// Add --user directory
// `installDir` from tool cache should look like $RUNNER_TOOL_CACHE/Python/<semantic version>/x64/
// So if `findLocalTool` succeeded above, we must have a conformant `installDir`
const version = path.basename(path.dirname(installDir));
const major = semver.major(version);
const minor = semver.minor(version);
@ -143,52 +145,26 @@ export async function useCpythonVersion(
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
// For Python >= 3.10 and architecture= 'x86', add the architecture-specific folder to the path
const arch = '32';
const pythonPath = path.join(
const userScriptsDir = path.join(
process.env['APPDATA'] || '',
'Python',
`Python${major}${minor}-${arch}`,
'Scripts'
);
core.addPath(pythonPath);
core.addPath(userScriptsDir);
} else {
// For Python >= 3.10 and architecture 'x64', or other versions, use the default user path
const pythonPath = path.join(
const userScriptsDir = path.join(
process.env['APPDATA'] || '',
'Python',
`Python${major}${minor}`,
'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
// 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
const pythonPath = path.join(
process.env['APPDATA'] || '',
'Python',
`Python${major}${minor}t`,
'Scripts'
);
core.addPath(pythonPath);
// 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.