make bootstrapping more robust for people who have Nim inside /usr/bin (#13855)

This commit is contained in:
Andreas Rumpf 2020-04-03 10:25:15 +02:00 • committed by GitHub
commit 2b3b24a804
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,6 +102,7 @@ proc staticWalkDirImpl(path: string, relative: bool): PNode =
result.add newTree(nkTupleConstr, newIntNode(nkIntLit, k.ord), result.add newTree(nkTupleConstr, newIntNode(nkIntLit, k.ord),
newStrNode(nkStrLit, f)) newStrNode(nkStrLit, f))
when defined(nimHasInvariant):
from std / compilesettings import SingleValueSetting, MultipleValueSetting from std / compilesettings import SingleValueSetting, MultipleValueSetting
proc querySettingImpl(a: VmArgs, conf: ConfigRef, switch: BiggestInt): string = proc querySettingImpl(a: VmArgs, conf: ConfigRef, switch: BiggestInt): string =
@ -181,6 +182,7 @@ proc registerAdditionalOps*(c: PCtx) =
systemop getCurrentException systemop getCurrentException
registerCallback c, "stdlib.*.staticWalkDir", proc (a: VmArgs) {.nimcall.} = registerCallback c, "stdlib.*.staticWalkDir", proc (a: VmArgs) {.nimcall.} =
setResult(a, staticWalkDirImpl(getString(a, 0), getBool(a, 1))) setResult(a, staticWalkDirImpl(getString(a, 0), getBool(a, 1)))
when defined(nimHasInvariant):
registerCallback c, "stdlib.compilesettings.querySetting", proc (a: VmArgs) {.nimcall.} = registerCallback c, "stdlib.compilesettings.querySetting", proc (a: VmArgs) {.nimcall.} =
setResult(a, querySettingImpl(a, c.config, getInt(a, 0))) setResult(a, querySettingImpl(a, c.config, getInt(a, 0)))
registerCallback c, "stdlib.compilesettings.querySettingSeq", proc (a: VmArgs) {.nimcall.} = registerCallback c, "stdlib.compilesettings.querySettingSeq", proc (a: VmArgs) {.nimcall.} =