Class PythonCommand
java.lang.Object
org.variantsync.diffdetective.shell.ShellCommand
org.variantsync.diffdetective.shell.PythonCommand
Command for running a python script with arguments.
This class provides a builder like API to add arguments passed to the python script which can be
interpreted by a specified python version.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPythonCommand
(String commandName, Path script) Constructs a shell command running a python script with arguments. -
Method Summary
Modifier and TypeMethodDescriptionPass the additional argumento.toString()
to the python script.Pass the additional argumentarg
to the python script.static PythonCommand
DiffDetectiveVenvPython3
(Path script) Constructs a python command interpretingscript
with the python version installed in the virtual environment of DiffDetective.String[]
parts()
Returns the String parts that define and configure the command execution.static PythonCommand
Constructs a python command interpretingscript
with the default python version installed.static PythonCommand
Constructs a python command interpretingscript
with the installed python 3 version.Methods inherited from class org.variantsync.diffdetective.shell.ShellCommand
interpretResult, toString
-
Field Details
-
DiffDetectiveVenv
Path to the python interpreter of the virtual environment (relative to the project/Git root). -
pythonName
-
script
-
args
-
-
Constructor Details
-
PythonCommand
Constructs a shell command running a python script with arguments.- Parameters:
commandName
- a path to the python interpreter used to interpretscript
script
- the python script to be executed
-
-
Method Details
-
addArg
Pass the additional argumentarg
to the python script. -
addArg
Pass the additional argumento.toString()
to the python script. -
Python
Constructs a python command interpretingscript
with the default python version installed. Note that this should only be used for testing or in a reproducible environment (for example Docker) to ensure correct functionality on all supported platforms. -
Python3
Constructs a python command interpretingscript
with the installed python 3 version. Note that this should only be used for testing or in a reproducible environment (for example Docker) to ensure correct functionality on all supported platforms. -
DiffDetectiveVenvPython3
Constructs a python command interpretingscript
with the python version installed in the virtual environment of DiffDetective. It should be safe to use this python version on all supported platform given that the virtual environment was set up correctly, which this method just assumes without checking.- See Also:
-
parts
Description copied from class:ShellCommand
Returns the String parts that define and configure the command execution. The first array entry is a path to an executable file. The others are arguments for that executable.Example: ["echo", "Hello World"]
- Specified by:
parts
in classShellCommand
- Returns:
- the parts of the shell command.
-