Make (install #head?) question more accurate.
This commit is contained in:
parent
5450dc8213
commit
44a2b80a64
2 changed files with 19 additions and 7 deletions
|
|
@ -667,7 +667,8 @@ proc install(packages: seq[PkgTuple],
|
||||||
except BuildFailed:
|
except BuildFailed:
|
||||||
# The package failed to build.
|
# The package failed to build.
|
||||||
# Check if we tried building a tagged version of the package.
|
# Check if we tried building a tagged version of the package.
|
||||||
if pv.ver.kind != verSpecial:
|
let headVer = parseVersionRange("#" & getHeadName(meth))
|
||||||
|
if pv.ver.kind != verSpecial and downloadVersion != headVer:
|
||||||
# If we tried building a tagged version of the package then
|
# If we tried building a tagged version of the package then
|
||||||
# ask the user whether they want to try building #head.
|
# ask the user whether they want to try building #head.
|
||||||
let promptResult = doPrompt and
|
let promptResult = doPrompt and
|
||||||
|
|
@ -675,8 +676,8 @@ proc install(packages: seq[PkgTuple],
|
||||||
" like to try installing '$1@#head' (latest unstable)?") %
|
" like to try installing '$1@#head' (latest unstable)?") %
|
||||||
[pv.name, $downloadVersion])
|
[pv.name, $downloadVersion])
|
||||||
if promptResult:
|
if promptResult:
|
||||||
let verRange = parseVersionRange("#" & getHeadName(meth))
|
|
||||||
result = install(@[(pv.name, verRange)], options, doPrompt)
|
result = install(@[(pv.name, headVer)], options, doPrompt)
|
||||||
else:
|
else:
|
||||||
raise newException(BuildFailed,
|
raise newException(BuildFailed,
|
||||||
"Aborting installation due to build failure")
|
"Aborting installation due to build failure")
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,17 @@ proc `==`*(spe: Special, spe2: Special): bool =
|
||||||
proc `<=`*(ver: Version, ver2: Version): bool =
|
proc `<=`*(ver: Version, ver2: Version): bool =
|
||||||
return (ver == ver2) or (ver < ver2)
|
return (ver == ver2) or (ver < ver2)
|
||||||
|
|
||||||
|
proc `==`*(range1: VersionRange, range2: VersionRange): bool =
|
||||||
|
if range1.kind != range2.kind : return false
|
||||||
|
result = case range1.kind
|
||||||
|
of verLater, verEarlier, verEqLater, verEqEarlier, verEq:
|
||||||
|
range1.ver == range2.ver
|
||||||
|
of verSpecial:
|
||||||
|
range1.spe == range2.spe
|
||||||
|
of verIntersect:
|
||||||
|
range1.verILeft == range2.verILeft and range1.verIRight == range2.verIRight
|
||||||
|
of verAny: true
|
||||||
|
|
||||||
proc withinRange*(ver: Version, ran: VersionRange): bool =
|
proc withinRange*(ver: Version, ran: VersionRange): bool =
|
||||||
case ran.kind
|
case ran.kind
|
||||||
of verLater:
|
of verLater:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue