Merge pull request #604 from alaviss/no-pkglist

config: don't error out if no package list found
This commit is contained in:
Dominik Picheta 2019-01-20 08:23:12 -08:00 committed by GitHub
commit e60ab12549
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,11 +68,12 @@ proc parseConfig*(): Config =
var e = next(p)
case e.kind
of cfgEof:
if currentPackageList.urls.len == 0 and currentPackageList.path == "":
raise newException(NimbleError, "Package list '$1' requires either url or path" % currentPackageList.name)
if currentPackageList.urls.len > 0 and currentPackageList.path != "":
raise newException(NimbleError, "Attempted to specify `url` and `path` for the same package list '$1'" % currentPackageList.name)
addCurrentPkgList(result, currentPackageList)
if currentSection.len > 0:
if currentPackageList.urls.len == 0 and currentPackageList.path == "":
raise newException(NimbleError, "Package list '$1' requires either url or path" % currentPackageList.name)
if currentPackageList.urls.len > 0 and currentPackageList.path != "":
raise newException(NimbleError, "Attempted to specify `url` and `path` for the same package list '$1'" % currentPackageList.name)
addCurrentPkgList(result, currentPackageList)
break
of cfgSectionStart:
addCurrentPkgList(result, currentPackageList)