All output from install command is now using the cli module.
This commit is contained in:
parent
87d6f85aea
commit
87567161b8
2 changed files with 8 additions and 6 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import parseutils, os, osproc, strutils, tables, pegs
|
import parseutils, os, osproc, strutils, tables, pegs
|
||||||
|
|
||||||
import packageinfo, packageparser, version, tools, common, options
|
import packageinfo, packageparser, version, tools, common, options, cli
|
||||||
|
|
||||||
type
|
type
|
||||||
DownloadMethod* {.pure.} = enum
|
DownloadMethod* {.pure.} = enum
|
||||||
|
|
@ -142,7 +142,6 @@ proc doDownload*(url: string, downloadDir: string, verRange: VersionRange,
|
||||||
##
|
##
|
||||||
## Returns the version of the repository which has been downloaded.
|
## Returns the version of the repository which has been downloaded.
|
||||||
template getLatestByTag(meth: untyped) {.dirty.} =
|
template getLatestByTag(meth: untyped) {.dirty.} =
|
||||||
echo("Found tags...")
|
|
||||||
# Find latest version that fits our ``verRange``.
|
# Find latest version that fits our ``verRange``.
|
||||||
var latest = findLatest(verRange, versions)
|
var latest = findLatest(verRange, versions)
|
||||||
## Note: HEAD is not used when verRange.kind is verAny. This is
|
## Note: HEAD is not used when verRange.kind is verAny. This is
|
||||||
|
|
@ -150,7 +149,7 @@ proc doDownload*(url: string, downloadDir: string, verRange: VersionRange,
|
||||||
|
|
||||||
# If no tagged versions satisfy our range latest.tag will be "".
|
# If no tagged versions satisfy our range latest.tag will be "".
|
||||||
# We still clone in that scenario because we want to try HEAD in that case.
|
# We still clone in that scenario because we want to try HEAD in that case.
|
||||||
# https://github.com/nimrod-code/nimble/issues/22
|
# https://github.com/nim-lang/nimble/issues/22
|
||||||
meth
|
meth
|
||||||
if $latest.ver != "":
|
if $latest.ver != "":
|
||||||
result = parseVersionRange($latest.ver)
|
result = parseVersionRange($latest.ver)
|
||||||
|
|
@ -188,7 +187,8 @@ proc doDownload*(url: string, downloadDir: string, verRange: VersionRange,
|
||||||
let versions = getTagsListRemote(url, downMethod).getVersionList()
|
let versions = getTagsListRemote(url, downMethod).getVersionList()
|
||||||
if versions.len > 0:
|
if versions.len > 0:
|
||||||
getLatestByTag:
|
getLatestByTag:
|
||||||
echo("Cloning latest tagged version: ", latest.tag)
|
display("Cloning", "latest tagged version: " & latest.tag,
|
||||||
|
priority = MediumPriority)
|
||||||
doClone(downMethod, url, downloadDir, latest.tag)
|
doClone(downMethod, url, downloadDir, latest.tag)
|
||||||
else:
|
else:
|
||||||
# If no commits have been tagged on the repo we just clone HEAD.
|
# If no commits have been tagged on the repo we just clone HEAD.
|
||||||
|
|
@ -202,7 +202,8 @@ proc doDownload*(url: string, downloadDir: string, verRange: VersionRange,
|
||||||
|
|
||||||
if versions.len > 0:
|
if versions.len > 0:
|
||||||
getLatestByTag:
|
getLatestByTag:
|
||||||
echo("Switching to latest tagged version: ", latest.tag)
|
display("Switching", "to latest tagged version: " & latest.tag,
|
||||||
|
priority = MediumPriority)
|
||||||
doCheckout(downMethod, downloadDir, latest.tag)
|
doCheckout(downMethod, downloadDir, latest.tag)
|
||||||
|
|
||||||
verifyClone()
|
verifyClone()
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ proc doCmd*(cmd: string) =
|
||||||
displayDebug("Executing", cmd)
|
displayDebug("Executing", cmd)
|
||||||
let (output, exitCode) = execCmdEx(cmd)
|
let (output, exitCode) = execCmdEx(cmd)
|
||||||
displayDebug("Finished", "with exit code " & $exitCode)
|
displayDebug("Finished", "with exit code " & $exitCode)
|
||||||
|
# TODO: Improve to show output in real-time.
|
||||||
displayDebug("Output", output)
|
displayDebug("Output", output)
|
||||||
|
|
||||||
if exitCode != QuitSuccess:
|
if exitCode != QuitSuccess:
|
||||||
|
|
@ -53,7 +54,7 @@ proc getNimrodVersion*: Version =
|
||||||
let vOutput = doCmdEx('"' & nimBin & "\" -v").output
|
let vOutput = doCmdEx('"' & nimBin & "\" -v").output
|
||||||
var matches: array[0..MaxSubpatterns, string]
|
var matches: array[0..MaxSubpatterns, string]
|
||||||
if vOutput.find(peg"'Version'\s{(\d+\.)+\d}", matches) == -1:
|
if vOutput.find(peg"'Version'\s{(\d+\.)+\d}", matches) == -1:
|
||||||
quit("Couldn't find Nim version.", QuitFailure)
|
raise newException(NimbleError, "Couldn't find Nim version.")
|
||||||
newVersion(matches[0])
|
newVersion(matches[0])
|
||||||
|
|
||||||
proc samePaths*(p1, p2: string): bool =
|
proc samePaths*(p1, p2: string): bool =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue