Template
1
0
mirror of https://github.com/aminya/setup-cpp synced 2024-11-30 21:22:30 +08:00

Compare commits

..

3 Commits

Author SHA1 Message Date
Amin Yahyaabadi
e77865a1bd fix: fix gcovr on Fedora/Archlinux 2024-10-30 23:50:53 -07:00
Amin Yahyaabadi
9f44eb2c24 fix: fix checking of up to date bin min versions 2024-10-30 23:40:53 -07:00
Amin Yahyaabadi
f85ad55d63 fix: handle version range for python 2024-10-30 23:22:07 -07:00
10 changed files with 32 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"ninja":"1.12.1","cmake":"3.30.4","task":"3.39.2","powershell":"7.4.5","pip":">=22.2.0","python":">=3.7.9","meson":{"linux":{"ubuntu":{"20":"1.5.2","18":"0.61.4","else":"0.61.4"},"else":"1.5.2"},"else":"1.5.2"},"kcov":{"linux":{"ubuntu":{"22":"42-binary","20":"40-binary","14":"40","else":"42"},"else":"42"},"else":"42"},"doxygen":{"linux":{"archlinux":"1.12.0-2","ubuntu":{"22":"1.12.0","18":"1.10.0","else":"1.10.0"},"else":"1.12.0"},"else":"1.12.0"},"gcc":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","else":""},"mingw":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","linux":{"ubuntu":{"22":"8.0.0-1","20":"7.0.0-2","else":"7.0.0-2"}},"else":""},"gcovr":{"linux":{"ubuntu":{"20":"","18":"5.0","else":"5.0"}},"else":""},"nala":{"linux":{"ubuntu":{"22":"","21":"legacy","else":"legacy"}},"else":""},"llvm":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang++":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang-tidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clangtidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang-format":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clangformat":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"}}
{"ninja":"1.12.1","cmake":"3.30.4","task":"3.39.2","powershell":"7.4.5","pip":">=22.2.0","python":">=3.7.9","meson":{"linux":{"ubuntu":{"20":"1.5.2","18":"0.61.4","else":"0.61.4"},"else":"1.5.2"},"else":"1.5.2"},"kcov":{"linux":{"ubuntu":{"22":"42-binary","20":"40-binary","14":"40","else":"42"},"else":"42"},"else":"42"},"doxygen":{"linux":{"archlinux":"1.12.0-2","ubuntu":{"22":"1.12.0","18":"1.10.0","else":"1.10.0"},"else":"1.12.0"},"else":"1.12.0"},"gcc":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","else":""},"mingw":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","linux":{"ubuntu":{"22":"8.0.0-1","20":"7.0.0-2","else":"7.0.0-2"},"else":""},"else":""},"gcovr":{"linux":{"ubuntu":{"20":"","18":"5.0","else":"5.0"},"else":""},"else":""},"nala":{"linux":{"ubuntu":{"22":"","21":"legacy","else":"legacy"},"else":""},"else":""},"llvm":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang++":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang-tidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clangtidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang-format":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clangformat":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"ninja":"1.12.1","cmake":"3.30.4","task":"3.39.2","powershell":"7.4.5","pip":">=22.2.0","python":">=3.7.9","meson":{"linux":{"ubuntu":{"20":"1.5.2","18":"0.61.4","else":"0.61.4"},"else":"1.5.2"},"else":"1.5.2"},"kcov":{"linux":{"ubuntu":{"22":"42-binary","20":"40-binary","14":"40","else":"42"},"else":"42"},"else":"42"},"doxygen":{"linux":{"archlinux":"1.12.0-2","ubuntu":{"22":"1.12.0","18":"1.10.0","else":"1.10.0"},"else":"1.12.0"},"else":"1.12.0"},"gcc":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","else":""},"mingw":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","linux":{"ubuntu":{"22":"8.0.0-1","20":"7.0.0-2","else":"7.0.0-2"}},"else":""},"gcovr":{"linux":{"ubuntu":{"20":"","18":"5.0","else":"5.0"}},"else":""},"nala":{"linux":{"ubuntu":{"22":"","21":"legacy","else":"legacy"}},"else":""},"llvm":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang++":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang-tidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clangtidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang-format":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clangformat":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"}}
{"ninja":"1.12.1","cmake":"3.30.4","task":"3.39.2","powershell":"7.4.5","pip":">=22.2.0","python":">=3.7.9","meson":{"linux":{"ubuntu":{"20":"1.5.2","18":"0.61.4","else":"0.61.4"},"else":"1.5.2"},"else":"1.5.2"},"kcov":{"linux":{"ubuntu":{"22":"42-binary","20":"40-binary","14":"40","else":"42"},"else":"42"},"else":"42"},"doxygen":{"linux":{"archlinux":"1.12.0-2","ubuntu":{"22":"1.12.0","18":"1.10.0","else":"1.10.0"},"else":"1.12.0"},"else":"1.12.0"},"gcc":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","else":""},"mingw":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","linux":{"ubuntu":{"22":"8.0.0-1","20":"7.0.0-2","else":"7.0.0-2"},"else":""},"else":""},"gcovr":{"linux":{"ubuntu":{"20":"","18":"5.0","else":"5.0"},"else":""},"else":""},"nala":{"linux":{"ubuntu":{"22":"","21":"legacy","else":"legacy"},"else":""},"else":""},"llvm":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang++":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang-tidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clangtidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang-format":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clangformat":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"}}

View File

@ -25,16 +25,13 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
import { hasPipx, setupPipPackSystem, setupPipPackWithPython } from "../utils/setup/setupPipPack.js"
import { isBinUptoDate } from "../utils/setup/version.js"
import { unique } from "../utils/std/index.js"
import { getVersionDefault } from "../versions/versions.js"
import { getVersionDefault, isMinVersion } from "../versions/versions.js"
export async function setupPython(
givenVersion: string,
version: string,
setupDir: string,
arch: string,
): Promise<InstallationInfo & { bin: string }> {
// if a version range specified, use the default version, and later check the range
const version = givenVersion.endsWith(">=") ? "" : givenVersion
const installInfo = await findOrSetupPython(version, setupDir, arch)
assert(installInfo.bin !== undefined)
const foundPython = installInfo.bin
@ -92,7 +89,10 @@ async function setupWheel(foundPython: string) {
}
}
async function findOrSetupPython(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
async function findOrSetupPython(givenVersion: string, setupDir: string, arch: string): Promise<InstallationInfo> {
// if a version range specified, use the default version, and later check the range
const version = isMinVersion(givenVersion) ? "" : givenVersion
let installInfo: InstallationInfo | undefined
let foundPython = await findPython(setupDir)

View File

@ -3,6 +3,7 @@ import { info } from "ci-log"
import { isUrlOnline } from "is-url-online"
import semverCoerce from "semver/functions/coerce"
import semverCompare from "semver/functions/compare"
import semverSatisfies from "semver/functions/satisfies"
import semverValid from "semver/functions/valid"
/**
@ -112,7 +113,15 @@ export async function isBinUptoDate(
) {
const givenVersion = await getBinVersion(givenFile, versionRegex)
if (givenVersion !== undefined && targetVersion !== "") {
return semverCompare(givenVersion, targetVersion) !== -1
try {
// if -1, it means the given version is newer than the target version
// this requires the target version to be a valid semver range
return semverCompare(givenVersion, targetVersion) !== -1
} catch {
// check if the given version satisfies the target version
// this works even if the target version is not a valid semver range (e.g. >=1.2.3)
return semverSatisfies(givenVersion, targetVersion)
}
} else {
// assume given version is old
return false

View File

@ -51,7 +51,8 @@
"22": "8.0.0-1",
"20": "7.0.0-2",
"else": "7.0.0-2"
}
},
"else": ""
},
"else": ""
},
@ -61,7 +62,8 @@
"20": "",
"18": "5.0",
"else": "5.0"
}
},
"else": ""
},
"else": ""
},
@ -71,7 +73,8 @@
"22": "",
"21": "legacy",
"else": "legacy"
}
},
"else": ""
},
"else": ""
},

View File

@ -171,3 +171,7 @@ export function syncVersions(
return true
}
export function isMinVersion(version: string) {
return version.startsWith(">")
}