Use Nim binary if it exists.
This commit is contained in:
parent
64f05549eb
commit
3c1248c1b2
2 changed files with 9 additions and 3 deletions
|
|
@ -404,7 +404,7 @@ proc buildFromDir(pkgInfo: TPackageInfo, paths: seq[string]) =
|
||||||
for bin in pkgInfo.bin:
|
for bin in pkgInfo.bin:
|
||||||
echo("Building ", pkginfo.name, "/", bin, " using ", pkgInfo.backend,
|
echo("Building ", pkginfo.name, "/", bin, " using ", pkgInfo.backend,
|
||||||
" backend...")
|
" backend...")
|
||||||
doCmd("nimrod $# -d:release --noBabelPath $# \"$#\"" %
|
doCmd(getNimBin() & " $# -d:release --noBabelPath $# \"$#\"" %
|
||||||
[pkgInfo.backend, args, realDir / bin.changeFileExt("nim")])
|
[pkgInfo.backend, args, realDir / bin.changeFileExt("nim")])
|
||||||
|
|
||||||
proc saveBabelMeta(pkgDestDir, url: string, filesInstalled: TSet[string]) =
|
proc saveBabelMeta(pkgDestDir, url: string, filesInstalled: TSet[string]) =
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,17 @@ template cd*(dir: string, body: stmt) =
|
||||||
body
|
body
|
||||||
setCurrentDir(lastDir)
|
setCurrentDir(lastDir)
|
||||||
|
|
||||||
|
proc getNimBin*: string =
|
||||||
|
result = "nim"
|
||||||
|
if findExe("nim") != "": result = "nim"
|
||||||
|
elif findExe("nimrod") != "": result = "nimrod"
|
||||||
|
|
||||||
proc getNimrodVersion*: TVersion =
|
proc getNimrodVersion*: TVersion =
|
||||||
let vOutput = execProcess("nimrod -v")
|
let nimBin = getNimBin()
|
||||||
|
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 Nimrod version.", QuitFailure)
|
quit("Couldn't find Nim version.", QuitFailure)
|
||||||
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