mirror of https://github.com/aminya/setup-cpp
fix: relax and coerce the found pip version
This commit is contained in:
parent
9292ace132
commit
1f24044002
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -93,7 +93,7 @@ export async function getBinVersion(file: string, versionRegex: RegExp = default
|
|||
const execout = await getExecOutput(file, ["--version"])
|
||||
const version_output = execout.stdout || execout.stderr || ""
|
||||
const version = version_output.trim().match(versionRegex)?.[1]
|
||||
return version
|
||||
return semverCoerce(version) ?? undefined
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return undefined
|
||||
|
@ -107,12 +107,7 @@ export async function isBinUptoDate(
|
|||
versionRegex: RegExp = defaultVersionRegex
|
||||
) {
|
||||
const givenVersion = await getBinVersion(givenFile, versionRegex)
|
||||
if (
|
||||
typeof givenVersion === "string" &&
|
||||
typeof targetVersion === "string" &&
|
||||
givenVersion !== "" &&
|
||||
targetVersion !== ""
|
||||
) {
|
||||
if (givenVersion !== undefined && targetVersion !== "") {
|
||||
return semverCompare(givenVersion, targetVersion) !== -1
|
||||
} else {
|
||||
// assume given version is old
|
||||
|
|
|
@ -31,7 +31,7 @@ export const DefaultVersions: Record<string, string | undefined> = {
|
|||
}
|
||||
|
||||
export const MinVersions: Record<string, string | undefined> = {
|
||||
pip: "22.3.1",
|
||||
pip: "22.2.0",
|
||||
python: "3.7.9",
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue