Implemented download of packages residing in mercurial repos.

* Moved download handling code into a download module.
* Documented how versioning works for repos (via tags).
* More info during install about what tag is picked.
* Refactored download code to be more generic.
This commit is contained in:
Dominik Picheta 2013-07-26 23:58:25 +01:00
commit 07b7f46fd6
6 changed files with 162 additions and 77 deletions

View file

@ -5,6 +5,21 @@
import osproc, pegs, strutils, os
import version
# TODO: Merge with common.nim?
proc doCmd*(cmd: string) =
let exitCode = execCmd(cmd)
if exitCode != QuitSuccess:
quit("Execution failed with exit code " & $exitCode, QuitFailure)
template cd*(dir: string, body: stmt) =
## Sets the current dir to ``dir``, executes ``body`` and restores the
## previous working dir.
let lastDir = getCurrentDir()
setCurrentDir(dir)
body
setCurrentDir(lastDir)
proc getNimrodVersion*: TVersion =
let vOutput = execProcess("nimrod -v")
var matches: array[0..MaxSubpatterns, string]