Python commands execution utility. Use global python or binary in provided python path.
Usage: configure instance with builder style configuration methods and then execute commands. Command output may be redirected to gradle logger (with configurable level and prefix) or returned as result.
Arguments may be defined as:
['arg', 'arg']'arg arg --somekey'See Pip as example of usage for package specific utility.
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
callModule(java.lang.String module, java.lang.Object args)Calls command on module. |
|
Python |
clearExtraArgs()Removes all registered extra arguments. |
|
void |
exec(java.lang.Object args)Execute python command. |
|
Python |
extraArgs(java.lang.Object args)Useful if all called commands support common keys (usually this mean one module usage). |
|
java.lang.String |
getHomeDir()@return python home directory (works for global python too) |
|
java.lang.String |
getUsedBinary()@return python binary used |
|
java.lang.String |
getVersion()@return python version in format major.minor.micro |
|
Python |
logLevel(org.gradle.api.logging.LogLevel level)By default, org.gradle.api.logging.LogLevel#INFO level is used (visible with gradle '-i' flag). |
|
Python |
outputPrefix(java.lang.String prefix)By default '\t' prefix used (to indent python command output). |
|
java.lang.String |
readOutput(java.lang.Object args)Execute python command and return all output (without applying the prefix!). |
<T> |
T |
withHiddenLog(groovy.lang.Closure closure)Used to call python instance methods with hidden (not visible in gradle console) log (set to INFO). |
|
Python |
workDir(java.lang.String workDir)@param workDir working directory (null value ignored for simplified usage) |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Calls command on module. Useful for integrations to avoid manual arguments merge for module.
module - called python module nameargs - command line arguments (array, collection or simple string)Removes all registered extra arguments.
Execute python command. All output redirected to gradle log (line by line).
args - command line arguments (array, collection or simple string)Useful if all called commands support common keys (usually this mean one module usage). Arguments are appended. To cleat existing arguments see clearExtraArgs().
args - extra arguments (array, collection or simple string) to apply to all processed commands
(null value ignored for simplified usage)
By default, org.gradle.api.logging.LogLevel#INFO level is used (visible with gradle '-i' flag). For example, Pip use org.gradle.api.logging.LogLevel#LIFECYCLE because pip logs must be always visible.
level - gradle log level to use for python output (null value ignored for simplified usage)By default '\t' prefix used (to indent python command output).
prefix - prefix applied to python execution output (null mean no prefix)Execute python command and return all output (without applying the prefix!). Very handy for short scripts evaluation. In case of error, all output is logged (with prefix).
args - command line arguments (array, collection or simple string)Used to call python instance methods with hidden (not visible in gradle console) log (set to INFO).
closure - closure with python commands to execute
workDir - working directory (null value ignored for simplified usage)