MCPcopy Index your code
hub / github.com/actions/setup-python / installCpythonFromRelease

Function installCpythonFromRelease

src/install-python.ts:208–249  ·  view source on GitHub ↗
(release: tc.IToolRelease)

Source from the content-addressed store, hash-verified

206}
207
208export async function installCpythonFromRelease(release: tc.IToolRelease) {
209 if (!release.files || release.files.length === 0) {
210 throw new Error('No files found in the release to download.');
211 }
212 const downloadUrl = release.files[0].download_url;
213
214 core.info(`Download from "${downloadUrl}"`);
215 let pythonPath = '';
216 try {
217 const fileName = getDownloadFileName(downloadUrl);
218 pythonPath = await tc.downloadTool(downloadUrl, fileName, AUTH);
219 core.info('Extract downloaded archive');
220 let pythonExtractedFolder;
221 if (IS_WINDOWS) {
222 pythonExtractedFolder = await tc.extractZip(pythonPath);
223 } else {
224 pythonExtractedFolder = await tc.extractTar(pythonPath);
225 }
226
227 core.info('Execute installation script');
228 await installPython(pythonExtractedFolder);
229 } catch (err) {
230 if (err instanceof tc.HTTPError) {
231 // Rate limit?
232 if (err.httpStatusCode === 403) {
233 core.error(
234 `Received HTTP status code 403. This indicates a permission issue or restricted access.`
235 );
236 } else if (err.httpStatusCode === 429) {
237 core.info(
238 `Received HTTP status code 429. This usually indicates the rate limit has been exceeded`
239 );
240 } else {
241 core.info(err.message);
242 }
243 if (err.stack) {
244 core.debug(err.stack);
245 }
246 }
247 throw err;
248 }
249}

Callers

nothing calls this directly

Calls 2

getDownloadFileNameFunction · 0.90
installPythonFunction · 0.85

Tested by

no test coverage detected