( pythonVersion: string, pypyVersion: string, architecture: string )
| 106 | } |
| 107 | |
| 108 | export 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 | |
| 145 | export function parsePyPyVersion(versionSpec: string): IPyPyVersionSpec { |
| 146 | const versions = versionSpec.split('-').filter(item => !!item); |
no test coverage detected