diff --git a/babel.nim b/babel.nim index 2540b06..f848334 100644 --- a/babel.nim +++ b/babel.nim @@ -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]], diff --git a/download.nim b/download.nim index a64dc82..a554495 100644 --- a/download.nim +++ b/download.nim @@ -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