(versionSpec: string)
| 143 | } |
| 144 | |
| 145 | export function parsePyPyVersion(versionSpec: string): IPyPyVersionSpec { |
| 146 | const versions = versionSpec.split('-').filter(item => !!item); |
| 147 | |
| 148 | if (/^(pypy)(.+)/.test(versions[0])) { |
| 149 | const pythonVersion = versions[0].replace('pypy', ''); |
| 150 | versions.splice(0, 1, 'pypy', pythonVersion); |
| 151 | } |
| 152 | |
| 153 | if (versions.length < 2 || versions[0] != 'pypy') { |
| 154 | throw new Error( |
| 155 | "Invalid 'version' property for PyPy. PyPy version should be specified as 'pypy<python-version>' or 'pypy-<python-version>'. See README for examples and documentation." |
| 156 | ); |
| 157 | } |
| 158 | |
| 159 | const pythonVersion = versions[1]; |
| 160 | let pypyVersion: string; |
| 161 | if (versions.length > 2) { |
| 162 | pypyVersion = pypyInstall.pypyVersionToSemantic(versions[2]); |
| 163 | } else { |
| 164 | pypyVersion = 'x'; |
| 165 | } |
| 166 | |
| 167 | if (!validateVersion(pythonVersion) || !validateVersion(pypyVersion)) { |
| 168 | throw new Error( |
| 169 | "Invalid 'version' property for PyPy. Both Python version and PyPy versions should satisfy SemVer notation. See README for examples and documentation." |
| 170 | ); |
| 171 | } |
| 172 | |
| 173 | if (!validatePythonVersionFormatForPyPy(pythonVersion)) { |
| 174 | throw new Error( |
| 175 | "Invalid format of Python version for PyPy. Python version should be specified in format 'x.y'. See README for examples and documentation." |
| 176 | ); |
| 177 | } |
| 178 | |
| 179 | return { |
| 180 | pypyVersion: pypyVersion, |
| 181 | pythonVersion: pythonVersion |
| 182 | }; |
| 183 | } |
| 184 | |
| 185 | export function findPyPyInstallDirForWindows(pythonVersion: string): string { |
| 186 | let installDir = ''; |
no test coverage detected