mirror of
https://github.com/actions/setup-python.git
synced 2025-02-18 22:32:50 -05:00
update installer path for >=3.10
This commit is contained in:
parent
b10d984bba
commit
c002fb52fe
2 changed files with 45 additions and 16 deletions
21
dist/setup/index.js
vendored
21
dist/setup/index.js
vendored
|
@ -99605,14 +99605,25 @@ function useCpythonVersion(version, architecture, updateEnvironment, checkLatest
|
||||||
core.addPath(installDir);
|
core.addPath(installDir);
|
||||||
core.addPath(_binDir);
|
core.addPath(_binDir);
|
||||||
if (utils_1.IS_WINDOWS) {
|
if (utils_1.IS_WINDOWS) {
|
||||||
// Add --user directory
|
// Get Python version from the installDir path
|
||||||
// `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 version = path.basename(path.dirname(installDir));
|
||||||
const major = semver.major(version);
|
const major = semver.major(version);
|
||||||
const minor = semver.minor(version);
|
const minor = semver.minor(version);
|
||||||
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
|
if (major >= 3 && (major > 3 || minor >= 10)) {
|
||||||
core.addPath(userScriptsDir);
|
const arch = architecture === 'x64' ? '64' : '32';
|
||||||
|
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
|
||||||
|
core.addPath(userScriptsDir);
|
||||||
|
core.debug(`Updated PATH with architecture-specific path: ${userScriptsDir}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// For Python < 3.10, add the default path without architecture-specific folder as per the official installer path
|
||||||
|
const userScriptsDir = path.join(process.env['APPDATA'] || '', 'Python', `Python${major}${minor}`, 'Scripts');
|
||||||
|
// Add the default path to the environment PATH variable
|
||||||
|
core.addPath(userScriptsDir);
|
||||||
|
core.debug(`Updated PATH for Python < 3.10: ${userScriptsDir}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 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.
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,20 +134,38 @@ export async function useCpythonVersion(
|
||||||
core.addPath(_binDir);
|
core.addPath(_binDir);
|
||||||
|
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
// Add --user directory
|
// Get Python version from the installDir path
|
||||||
// `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 version = path.basename(path.dirname(installDir));
|
||||||
const major = semver.major(version);
|
const major = semver.major(version);
|
||||||
const minor = semver.minor(version);
|
const minor = semver.minor(version);
|
||||||
|
|
||||||
const userScriptsDir = path.join(
|
if (major >= 3 && (major > 3 || minor >= 10)) {
|
||||||
process.env['APPDATA'] || '',
|
|
||||||
'Python',
|
const arch = architecture === 'x64' ? '64' : '32';
|
||||||
`Python${major}${minor}`,
|
|
||||||
'Scripts'
|
const userScriptsDir = path.join(
|
||||||
);
|
process.env['APPDATA'] || '',
|
||||||
core.addPath(userScriptsDir);
|
'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
|
||||||
|
core.addPath(userScriptsDir);
|
||||||
|
core.debug(`Updated PATH with architecture-specific path: ${userScriptsDir}`);
|
||||||
|
} else {
|
||||||
|
// For Python < 3.10, add the default path without architecture-specific folder as per the official installer path
|
||||||
|
const userScriptsDir = path.join(
|
||||||
|
process.env['APPDATA'] || '',
|
||||||
|
'Python',
|
||||||
|
`Python${major}${minor}`,
|
||||||
|
'Scripts'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add the default path to the environment PATH variable
|
||||||
|
core.addPath(userScriptsDir);
|
||||||
|
core.debug(`Updated PATH for Python < 3.10: ${userScriptsDir}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 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.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue