Common Tasks Module
Defines a set of operations that are common enough but also are tedious to define
Execute the given command, redirecting stdout and stderr to optionally given files
| Param : | command - list of command and arguments |
|---|---|
| Param : | stdout - file to redirect standard output to, if given |
| Param : | stderr - file to redirect standard error to, if given |
| Returns: | the error code of the subbed out call, $? |
Copy src to dst or copy files to dst
Copy a file or folder to a different file/folder If no src file is specified, will attempt to copy files to dst
Notice, elements of files will not be expanded before copying.
| Parameters: |
|
|---|
Compress (Zip) folder
Zip the specified directory into the zip file named zipfilename
| Parameters: |
|
|---|
Write a string to file
Write the given msg to a file named tofile
Notice, echo will overwrite the file if it already exists
| Parameters: |
|
|---|
Return a glob expansion generator of path_pattern
| Parameters: | path_pattern – pattern to expand |
|---|---|
| Return type: | generator of strings |
| Returns: | List of paths and/ or files |
Return boolean result if program is in PATH environment variable
| Parameters: | program – Program name to search for in PATH |
|---|---|
| Returns: | Return the PATH of program or None |
Log msg using tasks global logger
Emit the message (msg) to the xnt.tasks logger using either the default log level (INFO) or any valid specified value of logging module
| Parameters: |
|
|---|
Make a directory with mode
Create a directory specified by dir with default mode (where supported) or with the specified mode
Notice, if the directory already exists, mkdir will log a warning and return
| Parameters: |
|
|---|
Move src to dst
Move (copy and remove) the source file or directory (src) to the destination file or directory (dst)
| Parameters: |
|
|---|
Remove a set of files
Attempt to remove all the directories given by the fileset. Before rm tries to delete each element of fileset, it attempts to expand it first using glob expansion (xnt.tasks.expandpath()), thus allowing the passing of glob elements
| Parameters: | fileset – List of files to remove |
|---|
Invoke the setup.py file in the current or specified directory
| Param : | commands - list of commands and options to run/ append |
|---|---|
| Param : | dir - (optional) directory to run from |
| Returns: | the error code of the execution, $? |
Similar to Linux/Unix which: return (first) path of executable
| Parameters: | program – program name to search for in PATH |
|---|---|
| Returns: | Return the PATH of program or None |
Invoke xnt on another build file in a different directory
| Param : | path - to the build file (including build file) |
|---|---|
| Param : | targets - list of targets to execute |
| Param : | props - dictionary of properties to pass to the build module |