Added a more descriptive error when trying to install a version of a

package which does not exist.
This commit is contained in:
Dominik Picheta 2013-12-15 16:30:45 +00:00
commit b266132da0
2 changed files with 7 additions and 8 deletions

View file

@ -325,15 +325,16 @@ proc downloadPkg(url: string, verRange: PVersionRange,
downMethod: TDownloadMethod): string =
let downloadDir = (getTempDir() / "babel" / "url_unknown")
if not existsDir(getTempDir() / "babel"): createDir(getTempDir() / "babel")
echo("Downloading ", url, " into ", downloadDir, "...")
echo("Downloading ", url, " into ", downloadDir, " using ", downMethod, "...")
doDownload(url, downloadDir, verRange, downMethod)
result = downloadDir
proc downloadPkg(pkg: TPackage, verRange: PVersionRange): string =
let downloadDir = (getTempDir() / "babel" / pkg.name)
if not existsDir(getTempDir() / "babel"): createDir(getTempDir() / "babel")
echo("Downloading ", pkg.name, " into ", downloadDir, "...")
doDownload(pkg, downloadDir, verRange)
let downMethod = pkg.downloadMethod.getDownloadMethod()
echo("Downloading ", pkg.name, " into ", downloadDir, " using ", downMethod, "...")
doDownload(pkg.url, downloadDir, verRange, downMethod)
result = downloadDir
proc install(packages: seq[tuple[name: string, verRange: PVersionRange]],

View file

@ -128,6 +128,9 @@ proc doDownload*(url: string, downloadDir: string, verRange: PVersionRange,
## intended behaviour, the latest tagged version will be used in this case.
if latest.tag != "":
meth
else:
raise newException(EBabel,
"Could not find a version which fits the specified range: " & $verRange)
proc verifyHead() =
## Makes sure that HEAD satisfies the requested version range.
@ -175,11 +178,6 @@ proc doDownload*(url: string, downloadDir: string, verRange: PVersionRange,
elif verRange.kind != verAny:
verifyHead()
proc doDownload*(pkg: TPackage, downloadDir: string, verRange: PVersionRange) =
let downMethod = pkg.downloadMethod.getDownloadMethod()
echo "Downloading ", pkg.name, " using ", downMethod, "..."
doDownload(pkg.url, downloadDir, verRange, downMethod)
proc echoPackageVersions*(pkg: TPackage) =
let downMethod = pkg.downloadMethod.getDownloadMethod()
case downMethod