Procs
proc execAction(cmd: string; nostderr = false): string {...}{. raises: [OSError, Exception, IOError, Defect], tags: [ExecIOEffect, ReadIOEffect, RootEffect].}
-
Execute an external command - supported at compile time
Checks if command exits successfully before returning. If not, an error is raised.
proc mkDir(dir: string) {...}{.raises: [OSError, Exception, IOError, Defect, ValueError], tags: [ ReadDirEffect, ExecIOEffect, ReadIOEffect, RootEffect].}
-
Create a directory at cmopile time
The os module is not available at compile time so a few crucial helper functions are included with nimterop.
proc cpFile(source, dest: string; move = false) {...}{. raises: [OSError, Exception, IOError, Defect, ValueError], tags: [ExecIOEffect, ReadIOEffect, RootEffect].}
- Copy a file from source to destination at compile time
proc mvFile(source, dest: string) {...}{.raises: [OSError, Exception, IOError, Defect, ValueError], tags: [ExecIOEffect, ReadIOEffect, RootEffect].}
- Move a file from source to destination at compile time
proc extractZip(zipfile, outdir: string) {...}{.raises: [OSError, Exception, IOError, Defect, ValueError], tags: [ExecIOEffect, ReadIOEffect, RootEffect].}
- Extract a zip file using powershell on Windows and unzip on other systems to the specified output directory
proc downloadUrl(url, outdir: string) {...}{.raises: [OSError, Exception, IOError, Defect, ValueError], tags: [ReadDirEffect, ExecIOEffect, ReadIOEffect, RootEffect].}
-
Download a file using powershell on Windows and curl on other systems to the specified output directory
If a zip file, it is automatically extracted after download.
proc gitReset(outdir: string) {...}{.raises: [ValueError, OSError, Exception, IOError, Defect], tags: [ ExecIOEffect, ReadIOEffect, RootEffect, TimeEffect].}
- Hard reset the git repository at the specified directory
proc gitCheckout(file, outdir: string) {...}{.raises: [ValueError, OSError, Exception, IOError, Defect], tags: [ExecIOEffect, ReadIOEffect, RootEffect, TimeEffect].}
-
Checkout the specified file in the git repository specified
This effectively resets all changes in the file and can be used to undo any changes that were made to source files to enable successful wrapping with cImport() or c2nImport().
proc gitPull(url: string; outdir = ""; plist = ""; checkout = "") {...}{. raises: [ValueError, OSError, Exception, IOError, Defect], tags: [ReadDirEffect, ExecIOEffect, ReadIOEffect, RootEffect, TimeEffect, WriteIOEffect].}
-
Pull the specified git repository to the output directory
plist is the list of specific files and directories or wildcards to sparsely checkout. Multiple values can be specified one entry per line. It is optional and if omitted, the entire repository will be checked out.
checkout is the git tag, branch or commit hash to checkout once the repository is downloaded. This allows for pinning to a specific version of the code.
proc configure(path, check: string; flags = "") {...}{. raises: [OSError, Exception, IOError, Defect, ValueError], tags: [ReadDirEffect, ExecIOEffect, ReadIOEffect, RootEffect].}
-
Run the GNU configure command to generate all Makefiles or other build scripts in the specified path
If a configure script is not present and an autogen.sh script is present, it will be run before attempting configure.
check is a file that will be generated by the configure command. This is required to prevent configure from running on every build. It is relative to the path and should not be an absolute path.
flags are any flags that should be passed to the configure command.
proc cmake(path, check, flags: string) {...}{.raises: [OSError, Exception, IOError, Defect, ValueError], tags: [ReadDirEffect, ExecIOEffect, ReadIOEffect, RootEffect].}
-
Run the cmake command to generate all Makefiles or other build scripts in the specified path
path will be created since typically cmake is run in an empty directory.
check is a file that will be generated by the cmake command. This is required to prevent cmake from running on every build. It is relative to the path and should not be an absolute path.
flags are any flags that should be passed to the cmake command. Unlike configure, it is required since typically it will be the path to the repository, typically .. when path is a subdir.
proc make(path, check: string; flags = "") {...}{.raises: [ValueError, OSError, Exception, IOError, Defect], tags: [ReadDirEffect, ExecIOEffect, ReadIOEffect, RootEffect].}
-
Run the make command to build all binaries in the specified path
check is a file that will be generated by the make command. This is required to prevent make from running on every build. It is relative to the path and should not be an absolute path.
flags are any flags that should be passed to the make command.