Fixes problems caused by "" being present in the version list.
Specifically, not being able to install nim-vorbis.
This commit is contained in:
parent
e789a7a325
commit
7e2d46a52c
3 changed files with 21 additions and 7 deletions
|
|
@ -58,10 +58,14 @@ proc getTagsList(dir: string, meth: TDownloadMethod): seq[string] =
|
||||||
if output.len > 0:
|
if output.len > 0:
|
||||||
case meth
|
case meth
|
||||||
of TDownloadMethod.Git:
|
of TDownloadMethod.Git:
|
||||||
result = output.splitLines()
|
result = @[]
|
||||||
|
for i in output.splitLines():
|
||||||
|
if i == "": continue
|
||||||
|
result.add(i)
|
||||||
of TDownloadMethod.Hg:
|
of TDownloadMethod.Hg:
|
||||||
result = @[]
|
result = @[]
|
||||||
for i in output.splitLines():
|
for i in output.splitLines():
|
||||||
|
if i == "": continue
|
||||||
var tag = ""
|
var tag = ""
|
||||||
discard parseUntil(i, tag, ' ')
|
discard parseUntil(i, tag, ' ')
|
||||||
if tag != "tip":
|
if tag != "tip":
|
||||||
|
|
@ -91,6 +95,7 @@ proc getVersionList*(tags: seq[string]): TTable[TVersion, string] =
|
||||||
# Returns: TTable of version -> git tag name
|
# Returns: TTable of version -> git tag name
|
||||||
result = initTable[TVersion, string]()
|
result = initTable[TVersion, string]()
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
|
if tag != "":
|
||||||
let i = skipUntil(tag, digits) # skip any chars before the version
|
let i = skipUntil(tag, digits) # skip any chars before the version
|
||||||
# TODO: Better checking, tags can have any names. Add warnings and such.
|
# TODO: Better checking, tags can have any names. Add warnings and such.
|
||||||
result[newVersion(tag[i .. -1])] = tag
|
result[newVersion(tag[i .. -1])] = tag
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,8 @@ proc findPkg*(pkglist: seq[tuple[pkginfo: TPackageInfo, meta: TMetaData]],
|
||||||
## of ``dep.ver``. ``True`` is returned if a package is found. If multiple
|
## of ``dep.ver``. ``True`` is returned if a package is found. If multiple
|
||||||
## packages are found the newest one is returned (the one with the highest
|
## packages are found the newest one is returned (the one with the highest
|
||||||
## version number)
|
## version number)
|
||||||
|
##
|
||||||
|
## **Note**: dep.name here could be a URL, hence the need for pkglist.meta.
|
||||||
for pkg in pkglist:
|
for pkg in pkglist:
|
||||||
if pkg.pkginfo.name != dep.name and pkg.meta.url != dep.name: continue
|
if pkg.pkginfo.name != dep.name and pkg.meta.url != dep.name: continue
|
||||||
if withinRange(newVersion(pkg.pkginfo.version), dep.ver):
|
if withinRange(newVersion(pkg.pkginfo.version), dep.ver):
|
||||||
|
|
|
||||||
11
tools.nim
11
tools.nim
|
|
@ -62,8 +62,15 @@ proc getDownloadDirName*(url: string, verRange: PVersionRange): string =
|
||||||
of strutils.Letters, strutils.Digits:
|
of strutils.Letters, strutils.Digits:
|
||||||
result.add i
|
result.add i
|
||||||
else: nil
|
else: nil
|
||||||
|
|
||||||
|
let verSimple = getSimpleString(verRange)
|
||||||
|
if verSimple != "":
|
||||||
result.add "_"
|
result.add "_"
|
||||||
result.add getSimpleString(verRange)
|
result.add verSimple
|
||||||
|
|
||||||
proc getDownloadDirName*(pkg: TPackage, verRange: PVersionRange): string =
|
proc getDownloadDirName*(pkg: TPackage, verRange: PVersionRange): string =
|
||||||
result = pkg.name & "_" & verRange.getSimpleString
|
result = pkg.name
|
||||||
|
let verSimple = getSimpleString(verRange)
|
||||||
|
if verSimple != "":
|
||||||
|
result.add "_"
|
||||||
|
result.add verSimple
|
||||||
Loading…
Add table
Add a link
Reference in a new issue