API reference
- class goeiedag.Graph
This class is used to define the graph of inputs, outputs and the processing steps in between.
A graph defines a set of targets, each being either an output of a
command, or analias.- add(command, *, inputs, outputs)
Define how the given inputs are transformed into outputs.
The command, its arguments, inputs and outputs can be any combination of
strandPath.- Parameters:
command (sequence) – The command and its arguments. May contain input/output placeholders.
inputs (sequence or dict) – Inputs to the command, as a sequence or dict with
strkeys.outputs (sequence or dict) – Outputs of the command, as a sequence or dict with
strkeys.
- Example:
Concatenate two files to produce a third one:
graph.add(["cat", ALL_INPUTS, ">", OUTPUT.result], inputs=["os-name.txt", "username.txt"], outputs=dict(result="result.txt"))
- add_alias(*args, name=None)
Create an alias target. Building this target will build all the targets named as arguments.
- Parameters:
args (sequence of str and/or Path) – One or more targets.
name (str or None) – Optional name of the alias. If not provided, a unique name will be assigned.
- Returns:
The name of the new alias.
- Return type:
str
- goeiedag.build_all(g, build_dir, cwd=None)
Build all targets in the given graph.
- Parameters:
g (Graph) – a graph
build_dir (Path) – A directory which will be used for build-related files (Ninja file, etc.)
cwd (Path or None) – Working directory for the build. Any relative paths specified in the graph will be relative to this directory. If not specified, build_dir will be used.
- goeiedag.build_targets(g, build_dir, targets, cwd=None)
Build the given targets.
- Parameters:
g (Graph) – a graph
build_dir (Path) – A directory which will be used for build-related files (Ninja file, etc.)
targets (sequence of str and/or Path) – A set of previously declared targets (outputs or aliases) to build.
cwd (Path or None) – Working directory for the build. Any relative paths specified in the graph will be relative to this directory. If not specified, build_dir will be used.