@@ -66496,27 +66496,45 @@ function installPyPy(pypyVersion, pythonVersion, architecture, releases) {
66496
66496
const { foundAsset, resolvedPythonVersion, resolvedPyPyVersion } = releaseData;
66497
66497
let downloadUrl = `${foundAsset.download_url}`;
66498
66498
core.info(`Downloading PyPy from "${downloadUrl}" ...`);
66499
- const pypyPath = yield tc.downloadTool(downloadUrl);
66500
- core.info('Extracting downloaded archive...');
66501
- if (utils_1.IS_WINDOWS) {
66502
- downloadDir = yield tc.extractZip(pypyPath);
66499
+ try {
66500
+ const pypyPath = yield tc.downloadTool(downloadUrl);
66501
+ core.info('Extracting downloaded archive...');
66502
+ if (utils_1.IS_WINDOWS) {
66503
+ downloadDir = yield tc.extractZip(pypyPath);
66504
+ }
66505
+ else {
66506
+ downloadDir = yield tc.extractTar(pypyPath, undefined, 'x');
66507
+ }
66508
+ // root folder in archive can have unpredictable name so just take the first folder
66509
+ // downloadDir is unique folder under TEMP and can't contain any other folders
66510
+ const archiveName = fs_1.default.readdirSync(downloadDir)[0];
66511
+ const toolDir = path.join(downloadDir, archiveName);
66512
+ let installDir = toolDir;
66513
+ if (!utils_1.isNightlyKeyword(resolvedPyPyVersion)) {
66514
+ installDir = yield tc.cacheDir(toolDir, 'PyPy', resolvedPythonVersion, architecture);
66515
+ }
66516
+ utils_1.writeExactPyPyVersionFile(installDir, resolvedPyPyVersion);
66517
+ const binaryPath = getPyPyBinaryPath(installDir);
66518
+ yield createPyPySymlink(binaryPath, resolvedPythonVersion);
66519
+ yield installPip(binaryPath);
66520
+ return { installDir, resolvedPythonVersion, resolvedPyPyVersion };
66521
+ }
66522
+ catch (err) {
66523
+ if (err instanceof Error) {
66524
+ // Rate limit?
66525
+ if (err instanceof tc.HTTPError &&
66526
+ (err.httpStatusCode === 403 || err.httpStatusCode === 429)) {
66527
+ core.info(`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`);
66528
+ }
66529
+ else {
66530
+ core.info(err.message);
66531
+ }
66532
+ if (err.stack !== undefined) {
66533
+ core.debug(err.stack);
66534
+ }
66535
+ }
66536
+ throw err;
66503
66537
}
66504
- else {
66505
- downloadDir = yield tc.extractTar(pypyPath, undefined, 'x');
66506
- }
66507
- // root folder in archive can have unpredictable name so just take the first folder
66508
- // downloadDir is unique folder under TEMP and can't contain any other folders
66509
- const archiveName = fs_1.default.readdirSync(downloadDir)[0];
66510
- const toolDir = path.join(downloadDir, archiveName);
66511
- let installDir = toolDir;
66512
- if (!utils_1.isNightlyKeyword(resolvedPyPyVersion)) {
66513
- installDir = yield tc.cacheDir(toolDir, 'PyPy', resolvedPythonVersion, architecture);
66514
- }
66515
- utils_1.writeExactPyPyVersionFile(installDir, resolvedPyPyVersion);
66516
- const binaryPath = getPyPyBinaryPath(installDir);
66517
- yield createPyPySymlink(binaryPath, resolvedPythonVersion);
66518
- yield installPip(binaryPath);
66519
- return { installDir, resolvedPythonVersion, resolvedPyPyVersion };
66520
66538
});
66521
66539
}
66522
66540
exports.installPyPy = installPyPy;
@@ -66708,17 +66726,36 @@ function installCpythonFromRelease(release) {
66708
66726
return __awaiter(this, void 0, void 0, function* () {
66709
66727
const downloadUrl = release.files[0].download_url;
66710
66728
core.info(`Download from "${downloadUrl}"`);
66711
- const pythonPath = yield tc.downloadTool(downloadUrl, undefined, AUTH);
66712
- core.info('Extract downloaded archive');
66713
- let pythonExtractedFolder;
66714
- if (utils_1.IS_WINDOWS) {
66715
- pythonExtractedFolder = yield tc.extractZip(pythonPath);
66729
+ let pythonPath = '';
66730
+ try {
66731
+ pythonPath = yield tc.downloadTool(downloadUrl, undefined, AUTH);
66732
+ core.info('Extract downloaded archive');
66733
+ let pythonExtractedFolder;
66734
+ if (utils_1.IS_WINDOWS) {
66735
+ pythonExtractedFolder = yield tc.extractZip(pythonPath);
66736
+ }
66737
+ else {
66738
+ pythonExtractedFolder = yield tc.extractTar(pythonPath);
66739
+ }
66740
+ core.info('Execute installation script');
66741
+ yield installPython(pythonExtractedFolder);
66716
66742
}
66717
- else {
66718
- pythonExtractedFolder = yield tc.extractTar(pythonPath);
66743
+ catch (err) {
66744
+ if (err instanceof Error) {
66745
+ // Rate limit?
66746
+ if (err instanceof tc.HTTPError &&
66747
+ (err.httpStatusCode === 403 || err.httpStatusCode === 429)) {
66748
+ core.info(`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`);
66749
+ }
66750
+ else {
66751
+ core.info(err.message);
66752
+ }
66753
+ if (err.stack !== undefined) {
66754
+ core.debug(err.stack);
66755
+ }
66756
+ }
66757
+ throw err;
66719
66758
}
66720
- core.info('Execute installation script');
66721
- yield installPython(pythonExtractedFolder);
66722
66759
});
66723
66760
}
66724
66761
exports.installCpythonFromRelease = installCpythonFromRelease;
0 commit comments