diff --git a/download.nim b/download.nim index a554495..5022035 100644 --- a/download.nim +++ b/download.nim @@ -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 diff --git a/packageinfo.nim b/packageinfo.nim index 0025415..b2877a9 100644 --- a/packageinfo.nim +++ b/packageinfo.nim @@ -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): diff --git a/tools.nim b/tools.nim index d00adb0..77dedcb 100644 --- a/tools.nim +++ b/tools.nim @@ -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 \ No newline at end of file + result = pkg.name + let verSimple = getSimpleString(verRange) + if verSimple != "": + result.add "_" + result.add verSimple \ No newline at end of file