Added a more descriptive error when trying to install a version of a
package which does not exist.
This commit is contained in:
parent
1a32055367
commit
b266132da0
2 changed files with 7 additions and 8 deletions
|
|
@ -325,15 +325,16 @@ proc downloadPkg(url: string, verRange: PVersionRange,
|
||||||
downMethod: TDownloadMethod): string =
|
downMethod: TDownloadMethod): string =
|
||||||
let downloadDir = (getTempDir() / "babel" / "url_unknown")
|
let downloadDir = (getTempDir() / "babel" / "url_unknown")
|
||||||
if not existsDir(getTempDir() / "babel"): createDir(getTempDir() / "babel")
|
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)
|
doDownload(url, downloadDir, verRange, downMethod)
|
||||||
result = downloadDir
|
result = downloadDir
|
||||||
|
|
||||||
proc downloadPkg(pkg: TPackage, verRange: PVersionRange): string =
|
proc downloadPkg(pkg: TPackage, verRange: PVersionRange): string =
|
||||||
let downloadDir = (getTempDir() / "babel" / pkg.name)
|
let downloadDir = (getTempDir() / "babel" / pkg.name)
|
||||||
if not existsDir(getTempDir() / "babel"): createDir(getTempDir() / "babel")
|
if not existsDir(getTempDir() / "babel"): createDir(getTempDir() / "babel")
|
||||||
echo("Downloading ", pkg.name, " into ", downloadDir, "...")
|
let downMethod = pkg.downloadMethod.getDownloadMethod()
|
||||||
doDownload(pkg, downloadDir, verRange)
|
echo("Downloading ", pkg.name, " into ", downloadDir, " using ", downMethod, "...")
|
||||||
|
doDownload(pkg.url, downloadDir, verRange, downMethod)
|
||||||
result = downloadDir
|
result = downloadDir
|
||||||
|
|
||||||
proc install(packages: seq[tuple[name: string, verRange: PVersionRange]],
|
proc install(packages: seq[tuple[name: string, verRange: PVersionRange]],
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,9 @@ proc doDownload*(url: string, downloadDir: string, verRange: PVersionRange,
|
||||||
## intended behaviour, the latest tagged version will be used in this case.
|
## intended behaviour, the latest tagged version will be used in this case.
|
||||||
if latest.tag != "":
|
if latest.tag != "":
|
||||||
meth
|
meth
|
||||||
|
else:
|
||||||
|
raise newException(EBabel,
|
||||||
|
"Could not find a version which fits the specified range: " & $verRange)
|
||||||
|
|
||||||
proc verifyHead() =
|
proc verifyHead() =
|
||||||
## Makes sure that HEAD satisfies the requested version range.
|
## 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:
|
elif verRange.kind != verAny:
|
||||||
verifyHead()
|
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) =
|
proc echoPackageVersions*(pkg: TPackage) =
|
||||||
let downMethod = pkg.downloadMethod.getDownloadMethod()
|
let downMethod = pkg.downloadMethod.getDownloadMethod()
|
||||||
case downMethod
|
case downMethod
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue