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

Function parseGraalPyVersion

src/find-graalpy.ts:115–138  ·  view source on GitHub ↗
(versionSpec: string)

Source from the content-addressed store, hash-verified

113}
114
115export function parseGraalPyVersion(versionSpec: string): string {
116 const versions = versionSpec.split('-').filter(item => !!item);
117
118 if (/^(graalpy)(.+)/.test(versions[0])) {
119 const version = versions[0].replace('graalpy', '');
120 versions.splice(0, 1, 'graalpy', version);
121 }
122
123 if (versions.length < 2 || versions[0] != 'graalpy') {
124 throw new Error(
125 "Invalid 'version' property for GraalPy. GraalPy version should be specified as 'graalpy<python-version>' or 'graalpy-<python-version>'. See README for examples and documentation."
126 );
127 }
128
129 const pythonVersion = versions[1];
130
131 if (!validateVersion(pythonVersion)) {
132 throw new Error(
133 "Invalid 'version' property for GraalPy. GraalPy versions should satisfy SemVer notation. See README for examples and documentation."
134 );
135 }
136
137 return pythonVersion;
138}

Callers 1

findGraalPyVersionFunction · 0.85

Calls 1

validateVersionFunction · 0.90

Tested by

no test coverage detected