Merge pull request #180 from aminya/pip-version-check [skip ci]

This commit is contained in:
Amin Yahyaabadi 2023-07-15 15:23:46 -07:00 committed by GitHub
commit cdcbcdb02c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 33 additions and 38 deletions

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

View File

@ -93,7 +93,7 @@ export async function getBinVersion(file: string, versionRegex: RegExp = default
const execout = await getExecOutput(file, ["--version"]) const execout = await getExecOutput(file, ["--version"])
const version_output = execout.stdout || execout.stderr || "" const version_output = execout.stdout || execout.stderr || ""
const version = version_output.trim().match(versionRegex)?.[1] const version = version_output.trim().match(versionRegex)?.[1]
return version return semverCoerce(version) ?? undefined
} catch (e) { } catch (e) {
console.error(e) console.error(e)
return undefined return undefined
@ -107,12 +107,7 @@ export async function isBinUptoDate(
versionRegex: RegExp = defaultVersionRegex versionRegex: RegExp = defaultVersionRegex
) { ) {
const givenVersion = await getBinVersion(givenFile, versionRegex) const givenVersion = await getBinVersion(givenFile, versionRegex)
if ( if (givenVersion !== undefined && targetVersion !== "") {
typeof givenVersion === "string" &&
typeof targetVersion === "string" &&
givenVersion !== "" &&
targetVersion !== ""
) {
return semverCompare(givenVersion, targetVersion) !== -1 return semverCompare(givenVersion, targetVersion) !== -1
} else { } else {
// assume given version is old // assume given version is old

View File

@ -31,7 +31,7 @@ export const DefaultVersions: Record<string, string | undefined> = {
} }
export const MinVersions: Record<string, string | undefined> = { export const MinVersions: Record<string, string | undefined> = {
pip: "22.3.1", pip: "22.2.0",
python: "3.7.9", python: "3.7.9",
} }