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

Function findPyPyVersion

src/find-pypy.ts:23–106  ·  view source on GitHub ↗
(
  versionSpec: string,
  architecture: string,
  updateEnvironment: boolean,
  checkLatest: boolean,
  allowPreReleases: boolean
)

Source from the content-addressed store, hash-verified

21}
22
23export async function findPyPyVersion(
24 versionSpec: string,
25 architecture: string,
26 updateEnvironment: boolean,
27 checkLatest: boolean,
28 allowPreReleases: boolean
29): Promise<{resolvedPyPyVersion: string; resolvedPythonVersion: string}> {
30 let resolvedPyPyVersion = '';
31 let resolvedPythonVersion = '';
32 let installDir: string | null;
33 let releases: IPyPyManifestRelease[] | undefined;
34
35 const pypyVersionSpec = parsePyPyVersion(versionSpec);
36
37 if (checkLatest) {
38 releases = await pypyInstall.getAvailablePyPyVersions();
39 if (releases && releases.length > 0) {
40 const releaseData = pypyInstall.findRelease(
41 releases,
42 pypyVersionSpec.pythonVersion,
43 pypyVersionSpec.pypyVersion,
44 architecture,
45 false
46 );
47
48 if (releaseData) {
49 core.info(
50 `Resolved as PyPy ${releaseData.resolvedPyPyVersion} with Python (${releaseData.resolvedPythonVersion})`
51 );
52 pypyVersionSpec.pythonVersion = releaseData.resolvedPythonVersion;
53 pypyVersionSpec.pypyVersion = releaseData.resolvedPyPyVersion;
54 } else {
55 core.info(
56 `Failed to resolve PyPy ${pypyVersionSpec.pypyVersion} with Python (${pypyVersionSpec.pythonVersion}) from manifest`
57 );
58 }
59 }
60 }
61
62 ({installDir, resolvedPythonVersion, resolvedPyPyVersion} = findPyPyToolCache(
63 pypyVersionSpec.pythonVersion,
64 pypyVersionSpec.pypyVersion,
65 architecture
66 ));
67
68 if (!installDir) {
69 ({installDir, resolvedPythonVersion, resolvedPyPyVersion} =
70 await pypyInstall.installPyPy(
71 pypyVersionSpec.pypyVersion,
72 pypyVersionSpec.pythonVersion,
73 architecture,
74 allowPreReleases,
75 releases
76 ));
77 }
78
79 const pipDir = IS_WINDOWS ? 'Scripts' : 'bin';
80 const _binDir = path.join(installDir, pipDir);

Callers

nothing calls this directly

Calls 3

getBinaryDirectoryFunction · 0.90
parsePyPyVersionFunction · 0.85
findPyPyToolCacheFunction · 0.85

Tested by

no test coverage detected