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

Function findPyPyToolCache

src/find-pypy.ts:108–143  ·  view source on GitHub ↗
(
  pythonVersion: string,
  pypyVersion: string,
  architecture: string
)

Source from the content-addressed store, hash-verified

106}
107
108export function findPyPyToolCache(
109 pythonVersion: string,
110 pypyVersion: string,
111 architecture: string
112) {
113 let resolvedPyPyVersion = '';
114 let resolvedPythonVersion = '';
115 let installDir: string | null = IS_WINDOWS
116 ? findPyPyInstallDirForWindows(pythonVersion)
117 : tc.find('PyPy', pythonVersion, architecture);
118
119 if (installDir) {
120 // 'tc.find' finds tool based on Python version but we also need to check
121 // whether PyPy version satisfies requested version.
122 resolvedPythonVersion = getPyPyVersionFromPath(installDir);
123 resolvedPyPyVersion = readExactPyPyVersionFile(installDir);
124
125 const isPyPyVersionSatisfies = semver.satisfies(
126 resolvedPyPyVersion,
127 pypyVersion
128 );
129 if (!isPyPyVersionSatisfies) {
130 installDir = null;
131 resolvedPyPyVersion = '';
132 resolvedPythonVersion = '';
133 }
134 }
135
136 if (!installDir) {
137 core.info(
138 `PyPy version ${pythonVersion} (${pypyVersion}) was not found in the local cache`
139 );
140 }
141
142 return {installDir, resolvedPythonVersion, resolvedPyPyVersion};
143}
144
145export function parsePyPyVersion(versionSpec: string): IPyPyVersionSpec {
146 const versions = versionSpec.split('-').filter(item => !!item);

Callers 1

findPyPyVersionFunction · 0.85

Calls 3

getPyPyVersionFromPathFunction · 0.90
readExactPyPyVersionFileFunction · 0.90

Tested by

no test coverage detected