1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-python synced 2025-06-08 04:18:19 +02:00

Fix for Candidate Not Iterable Error (#1082)

* candidates not iterable

* update the error message

* update error to debug

* update debug to info

* error message updates
This commit is contained in:
aparnajyothi-y 2025-04-17 19:25:44 +05:30 committed by GitHub
parent e348410e00
commit 6ed2c67c8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 91 additions and 9 deletions

32
dist/setup/index.js vendored
View file

@ -97461,16 +97461,36 @@ function findReleaseFromManifest(semanticVersionSpec, architecture, manifest) {
});
}
exports.findReleaseFromManifest = findReleaseFromManifest;
function isIToolRelease(obj) {
return (typeof obj === 'object' &&
obj !== null &&
typeof obj.version === 'string' &&
typeof obj.stable === 'boolean' &&
Array.isArray(obj.files) &&
obj.files.every((file) => typeof file.filename === 'string' &&
typeof file.platform === 'string' &&
typeof file.arch === 'string' &&
typeof file.download_url === 'string'));
}
function getManifest() {
return __awaiter(this, void 0, void 0, function* () {
try {
return yield getManifestFromRepo();
const repoManifest = yield getManifestFromRepo();
if (Array.isArray(repoManifest) &&
repoManifest.length &&
repoManifest.every(isIToolRelease)) {
return repoManifest;
}
throw new Error('The repository manifest is invalid or does not include any valid tool release (IToolRelease) entries.');
}
catch (err) {
core.debug('Fetching the manifest via the API failed.');
if (err instanceof Error) {
core.debug(err.message);
}
else {
core.error('An unexpected error occurred while fetching the manifest.');
}
}
return yield getManifestFromURL();
});
@ -97518,6 +97538,9 @@ function installPython(workingDirectory) {
}
function installCpythonFromRelease(release) {
return __awaiter(this, void 0, void 0, function* () {
if (!release.files || release.files.length === 0) {
throw new Error('No files found in the release to download.');
}
const downloadUrl = release.files[0].download_url;
core.info(`Download from "${downloadUrl}"`);
let pythonPath = '';
@ -97538,8 +97561,11 @@ function installCpythonFromRelease(release) {
catch (err) {
if (err instanceof tc.HTTPError) {
// Rate limit?
if (err.httpStatusCode === 403 || err.httpStatusCode === 429) {
core.info(`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`);
if (err.httpStatusCode === 403) {
core.error(`Received HTTP status code 403. This indicates a permission issue or restricted access.`);
}
else if (err.httpStatusCode === 429) {
core.info(`Received HTTP status code 429. This usually indicates the rate limit has been exceeded`);
}
else {
core.info(err.message);