mirror of
https://github.com/actions/setup-python.git
synced 2026-03-19 23:50:24 +08:00
Merge 156786c425 into 28f2168f4d
This commit is contained in:
commit
ef2f5e3dfd
2 changed files with 52 additions and 0 deletions
24
dist/setup/index.js
vendored
24
dist/setup/index.js
vendored
|
|
@ -82997,6 +82997,30 @@ async function useCpythonVersion(version, architecture, updateEnvironment, check
|
||||||
installDir = tc.find('Python', semanticVersionSpec, architecture);
|
installDir = tc.find('Python', semanticVersionSpec, architecture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!installDir) {
|
||||||
|
// Try system Python as fallback (e.g., on architectures without pre-built binaries)
|
||||||
|
try {
|
||||||
|
const { exitCode, stdout } = await exec.getExecOutput('python3', [
|
||||||
|
'-c',
|
||||||
|
'import sys; print(sys.prefix)'
|
||||||
|
]);
|
||||||
|
if (exitCode === 0) {
|
||||||
|
const systemPrefix = stdout.trim();
|
||||||
|
const systemVersion = await exec.getExecOutput('python3', [
|
||||||
|
'-c',
|
||||||
|
'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")'
|
||||||
|
]);
|
||||||
|
if (systemVersion.exitCode === 0 &&
|
||||||
|
semver.satisfies(systemVersion.stdout.trim(), semanticVersionSpec)) {
|
||||||
|
installDir = systemPrefix;
|
||||||
|
core.warning(`Pre-built Python not available for architecture '${architecture}'. Using system Python ${systemVersion.stdout.trim()} at ${systemPrefix}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
// System Python not available, fall through to error
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!installDir) {
|
if (!installDir) {
|
||||||
const osInfo = await (0, utils_1.getOSInfo)();
|
const osInfo = await (0, utils_1.getOSInfo)();
|
||||||
const msg = [
|
const msg = [
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,34 @@ export async function useCpythonVersion(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!installDir) {
|
||||||
|
// Try system Python as fallback (e.g., on architectures without pre-built binaries)
|
||||||
|
try {
|
||||||
|
const {exitCode, stdout} = await exec.getExecOutput('python3', [
|
||||||
|
'-c',
|
||||||
|
'import sys; print(sys.prefix)'
|
||||||
|
]);
|
||||||
|
if (exitCode === 0) {
|
||||||
|
const systemPrefix = stdout.trim();
|
||||||
|
const systemVersion = await exec.getExecOutput('python3', [
|
||||||
|
'-c',
|
||||||
|
'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")'
|
||||||
|
]);
|
||||||
|
if (
|
||||||
|
systemVersion.exitCode === 0 &&
|
||||||
|
semver.satisfies(systemVersion.stdout.trim(), semanticVersionSpec)
|
||||||
|
) {
|
||||||
|
installDir = systemPrefix;
|
||||||
|
core.warning(
|
||||||
|
`Pre-built Python not available for architecture '${architecture}'. Using system Python ${systemVersion.stdout.trim()} at ${systemPrefix}.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// System Python not available, fall through to error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!installDir) {
|
if (!installDir) {
|
||||||
const osInfo = await getOSInfo();
|
const osInfo = await getOSInfo();
|
||||||
const msg = [
|
const msg = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue