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

Function installPyPy

src/install-pypy.ts:22–125  ·  view source on GitHub ↗
(
  pypyVersion: string,
  pythonVersion: string,
  architecture: string,
  allowPreReleases: boolean,
  releases: IPyPyManifestRelease[] | undefined
)

Source from the content-addressed store, hash-verified

20} from './utils';
21
22export async function installPyPy(
23 pypyVersion: string,
24 pythonVersion: string,
25 architecture: string,
26 allowPreReleases: boolean,
27 releases: IPyPyManifestRelease[] | undefined
28) {
29 let downloadDir;
30
31 releases = releases ?? (await getAvailablePyPyVersions());
32
33 if (!releases || releases.length === 0) {
34 throw new Error('No release was found in PyPy version.json');
35 }
36
37 let releaseData = findRelease(
38 releases,
39 pythonVersion,
40 pypyVersion,
41 architecture,
42 false
43 );
44
45 if (allowPreReleases && (!releaseData || !releaseData.foundAsset)) {
46 // check for pre-release
47 core.info(
48 [
49 `Stable PyPy version ${pythonVersion} (${pypyVersion}) with arch ${architecture} not found`,
50 `Trying pre-release versions`
51 ].join(os.EOL)
52 );
53 releaseData = findRelease(
54 releases,
55 pythonVersion,
56 pypyVersion,
57 architecture,
58 true
59 );
60 }
61
62 if (!releaseData || !releaseData.foundAsset) {
63 throw new Error(
64 `PyPy version ${pythonVersion} (${pypyVersion}) with arch ${architecture} not found`
65 );
66 }
67
68 const {foundAsset, resolvedPythonVersion, resolvedPyPyVersion} = releaseData;
69 const downloadUrl = `${foundAsset.download_url}`;
70
71 core.info(`Downloading PyPy from "${downloadUrl}" ...`);
72
73 try {
74 const fileName = getDownloadFileName(downloadUrl);
75 const pypyPath = await tc.downloadTool(downloadUrl, fileName);
76
77 core.info('Extracting downloaded archive...');
78 if (IS_WINDOWS) {
79 downloadDir = await tc.extractZip(pypyPath);

Callers

nothing calls this directly

Calls 8

getDownloadFileNameFunction · 0.90
isNightlyKeywordFunction · 0.90
getBinaryDirectoryFunction · 0.90
getAvailablePyPyVersionsFunction · 0.85
createPyPySymlinkFunction · 0.85
findReleaseFunction · 0.70
installPipFunction · 0.70

Tested by

no test coverage detected