Utility functions and classes for GSDView.
Functions
default_workdir() | Return the defaut workinhg directory. |
foramt_bugreport([exctype, excvalue, ...]) | |
format_platform_info() | |
geonormalize(x[, angle_range]) | Normalize angles to fit expected range |
getresource(resource[, package]) | Return the resurce path. |
isexecutable(cmd) | Check if “cmd” actually is an executable program. |
isscript(filename) | Check if a file is a script. |
scriptcmd(scriptname) | Return the list of args for starting the script via subprocess. |
which(cmd[, env]) | Return the full path of the program (cmd) or None. |
Return the full path of the program (cmd) or None.
>>> which('ls')
'/bin/ls'
Return the list of args for starting the script via subprocess.
On unix platforms the shebang string is used so almost all scripting languages are recognized.
On windows platforms this function only works with batch files and python scripts.
Note
if the scriptname is not recognized to be a script it is assumed it is a binary executable so the only argument in the returned list will be scriptname itself.
Parameters: | scriptname – the filename of the script |
---|---|
Returns: | a list of strings containing the command line arguments for startting the program via subprocess |
Return the resurce path.
If package is specified (usually passing __name__ of the called modile) the package resource name is returned.
If no package is specified then it is assumed that resource is located in the common resource directory (e.g. /usr/share/<PROJECTNAME> on UNIX-like systems.
Note
it is safe to use this function also if the package is distributed as a compressed egg or as standalon package generated using pyinstaller.