Fixes problems caused by "" being present in the version list.

Specifically, not being able to install nim-vorbis.
This commit is contained in:
Dominik Picheta 2013-12-20 16:39:43 +00:00
commit 7e2d46a52c
3 changed files with 21 additions and 7 deletions

View file

@ -58,10 +58,14 @@ proc getTagsList(dir: string, meth: TDownloadMethod): seq[string] =
if output.len > 0:
case meth
of TDownloadMethod.Git:
result = output.splitLines()
result = @[]
for i in output.splitLines():
if i == "": continue
result.add(i)
of TDownloadMethod.Hg:
result = @[]
for i in output.splitLines():
if i == "": continue
var tag = ""
discard parseUntil(i, tag, ' ')
if tag != "tip":
@ -91,9 +95,10 @@ proc getVersionList*(tags: seq[string]): TTable[TVersion, string] =
# Returns: TTable of version -> git tag name
result = initTable[TVersion, string]()
for tag in tags:
let i = skipUntil(tag, digits) # skip any chars before the version
# TODO: Better checking, tags can have any names. Add warnings and such.
result[newVersion(tag[i .. -1])] = tag
if tag != "":
let i = skipUntil(tag, digits) # skip any chars before the version
# TODO: Better checking, tags can have any names. Add warnings and such.
result[newVersion(tag[i .. -1])] = tag
proc getDownloadMethod*(meth: string): TDownloadMethod =
case meth

View file

@ -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
## packages are found the newest one is returned (the one with the highest
## version number)
##
## **Note**: dep.name here could be a URL, hence the need for pkglist.meta.
for pkg in pkglist:
if pkg.pkginfo.name != dep.name and pkg.meta.url != dep.name: continue
if withinRange(newVersion(pkg.pkginfo.version), dep.ver):

View file

@ -62,8 +62,15 @@ proc getDownloadDirName*(url: string, verRange: PVersionRange): string =
of strutils.Letters, strutils.Digits:
result.add i
else: nil
result.add "_"
result.add getSimpleString(verRange)
let verSimple = getSimpleString(verRange)
if verSimple != "":
result.add "_"
result.add verSimple
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