diff options
author | Araq <rumpf_a@web.de> | 2015-08-18 14:01:40 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-08-18 14:01:40 +0200 |
commit | 9659540b18b9bd76ea027c83a10077103fcc6318 (patch) | |
tree | ca63ea63432a64c589855eacc0a270dd1d1548a0 /lib | |
parent | 10a7830ba2b5e26f8a37c160f7425a3130d67ae0 (diff) | |
download | Nim-9659540b18b9bd76ea027c83a10077103fcc6318.tar.gz |
preparations for Nimble NimScript integrations; minor cleanups
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/nimscript.nim | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/system/nimscript.nim b/lib/system/nimscript.nim index 6f5977869..013b2cbc0 100644 --- a/lib/system/nimscript.nim +++ b/lib/system/nimscript.nim @@ -150,3 +150,30 @@ template task*(name: untyped; description: string; body: untyped): untyped = elif cmd ==? astToStr(name): setCommand "nop" `name Task`() + +type + VersionReq* = distinct string ## Describes a version requirement. + +template v*(name: string{lit}): VersionReq = VersionReq(name) +template special*(name: string): VersionReq = VersionReq(name) +template `<`*(v: VersionReq): VersionReq = VersionReq("<" & string(v)) +template `<=`*(v: VersionReq): VersionReq = VersionReq("<=" & string(v)) +template `>`*(v: VersionReq): VersionReq = VersionReq(">" & string(v)) +template `>=`*(v: VersionReq): VersionReq = VersionReq(">=" & string(v)) +template `&`*(a, b: VersionReq): VersionReq = + VersionReq(string(a) & " & " & string(b)) + +const + anyVersion* = VersionReq("*") + +var + packageName* = "" + version*, author*, description*, license*, srcdir*, + binDir*, backend*: string + + skipDirs*, skipFiles*, skipExt*, installDirs*, installFiles*, + installExt*, bin*: seq[string] + requiresData*: seq[(string, VersionReq)] + +proc requires*(name: string; v: VersionReq) = + requiresData.add((name, v)) |