mirror of
https://github.com/actions/setup-python.git
synced 2026-01-19 19:38:56 +08:00
resolved comments, update readme, add e2e tests.
This commit is contained in:
parent
739154f76b
commit
3d613a97df
7 changed files with 180 additions and 38 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import * as path from 'path';
|
||||
import * as pypyInstall from './install-pypy';
|
||||
import {IS_WINDOWS} from './utils';
|
||||
import {IS_WINDOWS, validateVersion} from './utils';
|
||||
|
||||
import * as semver from 'semver';
|
||||
import * as core from '@actions/core';
|
||||
|
|
@ -93,10 +93,12 @@ function parsePyPyVersion(versionSpec: string): IPyPyVersionSpec {
|
|||
const versions = versionSpec.split('-').filter(item => !!item);
|
||||
|
||||
if (versions.length < 2) {
|
||||
throw new Error(
|
||||
"Invalid 'version' property for PyPy. PyPy version should be specified as 'pypy-<python-version>'. See readme for more examples."
|
||||
core.setFailed(
|
||||
"Invalid 'version' property for PyPy. PyPy version should be specified as 'pypy-<python-version>'. See README for examples and documentation."
|
||||
);
|
||||
process.exit();
|
||||
}
|
||||
|
||||
const pythonVersion = versions[1];
|
||||
let pypyVersion: string;
|
||||
if (versions.length > 2) {
|
||||
|
|
@ -105,6 +107,13 @@ function parsePyPyVersion(versionSpec: string): IPyPyVersionSpec {
|
|||
pypyVersion = 'x';
|
||||
}
|
||||
|
||||
if (!validateVersion(pythonVersion) || !validateVersion(pypyVersion)) {
|
||||
core.setFailed(
|
||||
"Invalid 'version' property for PyPy. Both Python version and PyPy versions should satisfy SemVer notation. See README for examples and documentation."
|
||||
);
|
||||
process.exit();
|
||||
}
|
||||
|
||||
return {
|
||||
pypyVersion: pypyVersion,
|
||||
pythonVersion: pythonVersion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue