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

Compare commits

..

1 Commits

Author SHA1 Message Date
Amin Yahyaabadi
70e50f97d5 fix: handle version range for python 2024-10-25 03:03:21 -07:00
10 changed files with 16 additions and 32 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":""},"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"}} {"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"}}

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":""},"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"}} {"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"}}

View File

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

View File

@ -3,7 +3,6 @@ import { info } from "ci-log"
import { isUrlOnline } from "is-url-online" import { isUrlOnline } from "is-url-online"
import semverCoerce from "semver/functions/coerce" import semverCoerce from "semver/functions/coerce"
import semverCompare from "semver/functions/compare" import semverCompare from "semver/functions/compare"
import semverSatisfies from "semver/functions/satisfies"
import semverValid from "semver/functions/valid" import semverValid from "semver/functions/valid"
/** /**
@ -113,15 +112,7 @@ export async function isBinUptoDate(
) { ) {
const givenVersion = await getBinVersion(givenFile, versionRegex) const givenVersion = await getBinVersion(givenFile, versionRegex)
if (givenVersion !== undefined && targetVersion !== "") { if (givenVersion !== undefined && targetVersion !== "") {
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 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 { } else {
// assume given version is old // assume given version is old
return false return false

View File

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

View File

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