diff options
Diffstat (limited to 'tools/niminst/niminst.nim')
-rw-r--r-- | tools/niminst/niminst.nim | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim index d1216701f..991789a08 100644 --- a/tools/niminst/niminst.nim +++ b/tools/niminst/niminst.nim @@ -48,7 +48,8 @@ type fcWindows, # files only for Windows fcUnix, # files only for Unix; must be after ``fcWindows`` fcUnixBin, # binaries for Unix - fcDocStart # links to documentation for Windows installer + fcDocStart, # links to documentation for Windows installer + fcNimble # nimble package files to copy to /opt/nimble/pkgs/pkg-ver ConfigData = object of RootObj actions: set[Action] @@ -65,6 +66,7 @@ type app: AppType nimArgs: string debOpts: TDebOptions + nimblePkgName: string const unixDirVars: array[fcConfig..fcLib, string] = [ @@ -214,8 +216,11 @@ proc addFiles(s: var seq[string], patterns: seq[string]) = else: var i = 0 for f in walkFiles(p): - add(s, unixToNativePath(f)) - inc(i) + if existsDir(f): + walkDirRecursively(s, f) + else: + add(s, unixToNativePath(f)) + inc(i) if i == 0: echo("[Warning] No file found that matches: " & p) proc pathFlags(p: var CfgParser, k, v: string, @@ -362,6 +367,14 @@ proc parseIniFile(c: var ConfigData) = else: file.add(v[i]) inc(i) else: quit(errorStr(p, "unknown variable: " & k.key)) + of "nimble": + case normalize(k.key) + of "pkgname": + c.nimblePkgName = v + of "pkgfiles": + addFiles(c.cat[fcNimble], split(v, {';'})) + else: + quit(errorStr(p, "invalid key: " & k.key)) else: quit(errorStr(p, "invalid section: " & section)) of cfgOption: quit(errorStr(p, "syntax error")) @@ -554,8 +567,13 @@ when haveZipLib: for k, f in walkDir("build" / dir): if k == pcFile: addFile(z, proj / dir / extractFilename(f), f) - for cat in items({fcConfig..fcOther, fcUnix}): + for cat in items({fcConfig..fcOther, fcUnix, fcNimble}): for f in items(c.cat[cat]): addFile(z, proj / f, f) + + # Copy the .nimble file over + let nimbleFile = c.nimblePkgName & ".nimble" + processFile(z, proj / nimbleFile, nimbleFile) + close(z) else: quit("Cannot open for writing: " & n) @@ -587,9 +605,14 @@ proc xzDist(c: var ConfigData) = for k, f in walkDir("build" / dir): if k == pcFile: processFile(z, proj / dir / extractFilename(f), f) - for cat in items({fcConfig..fcOther, fcUnix}): + for cat in items({fcConfig..fcOther, fcUnix, fcNimble}): + echo("Current category: ", cat) for f in items(c.cat[cat]): processFile(z, proj / f, f) + # Copy the .nimble file over + let nimbleFile = c.nimblePkgName & ".nimble" + processFile(z, proj / nimbleFile, nimbleFile) + let oldDir = getCurrentDir() setCurrentDir(tmpDir) try: |