Wraps a block in a Python virtualenv. pysh or pybat steps are deprecated, and are simply copies or sh and bat respectively.

Example:

withPythonEnv('python3') {
    sh 'python --version'
}

The argument supplied to withPythonEnv is the name of the virtualenv to make available to any sh or bat steps called within the block.

Initially, withPythonEnv tries to match the string passed to it to a tool name. Currently, this means examining the installed tools for ShiningPanada. If the string matches an installed ShiningPanda Python tool instance, the virtualenv within that block is generated from that ShiningPanda tool.

Next, we attempt to match the string against an existing virtualenv directory. If we can find an existing virtualenv directory, we utilize that for the withPythonEnv block.

Otherwise, the text is treated "as-is". You can pass "python" to use the default Python installation of the node that the job runs on, or specify an executable path.