| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Now that we handle variable transformation more globally, we don't
need the transform value anymore
|
|
|
|
|
|
|
| |
Plugin tests are already accessing this API, but using imports from
private modules. For motivation for this to be exposed publicly, note
that ErrorDomain is an argument for most things in runcli.py, and
LoadErrorReason may be another.
|
|
|
|
|
|
|
| |
As discussed over the mailing list, reformat code using Black. This is a
one-off change to reformat all our codebase. Moving forward, we
shouldn't expect such blanket reformats. Rather, we expect each change
to already comply with the Black formatting style.
|
|
|
|
|
|
|
| |
This is in order to consolidate how we substitute variables.
_project: use 'node_subst_vars' instead of '_subst_list'
as the first one expects a node.
|
|
|
|
|
|
|
|
|
|
| |
As a first step, add type hints to variables whose type `mypy` cannot
infer automatically. This is the minimal set of type hints that allow
running `mypy` without any arguments, and having it not fail.
We currently ignore C extensions that mypy can't process directly.
Later, we can look into generating stubs for such modules (potentially
automatically).
|
|
|
|
| |
This improves the consistency of our error reporting
|
|
|
|
|
| |
In order to enable the 'spawn' method of creating jobs, make sure that
OptionPool is pickable, otherwise it cannot be sent to the job process.
|
|
|
|
|
|
| |
All of the errors which subclass from BstError have their first
positional argument as message, LoadError should follow this
ordering for consistency.
|
|
|
|
|
|
| |
`mapping.get_sequence(...).as_str_list()` is a very common
pattern seen both in plugins and the core. Adding a helper to reduce
the number of operations will make usage smoother
|
|
|
|
| |
This is not needed for plugins and should therefore not be public
|
|
|
|
|
| |
This makes the 'Node' API public, and available for use directly for
plugins.
|
|
|
|
|
|
|
| |
- _composite -> __composite (internal)
- composite -> _composite (BuildStream private)
- composite_under -> _composite_under (BuildStream private)
- get -> _get (internal)
|
|
|
|
|
|
|
|
| |
This replaces the helper method by adding a 'get_provenance' on the node
directly
- Adapt all call sites
- Delay getting provenance wherever possible without major refactor
|
|
|
|
|
| |
Now that we get scalar Nodes, it is easier to just give the node and
extract the provenance as needed.
|
|
|
|
|
|
|
|
|
| |
With nodes being propagated better, we now don't need to extract
provenance beforehand. Therefore removing the ability to provide
indiced when getting provenance.
- Also add 'scalar_at' on 'SequenceNode', in order to fetch a scalar
node at a specific indice
|
|
|
|
| |
- adapt all call sites to use the new API
|
|
|
|
|
| |
- Also take care of node_composite_move in the same way.
- Adapt all calling places
|
|
|
|
|
|
| |
- Implement __setitem__ on 'MappingNode'
- Implement __setitem__ on 'SequenceNode'
- Adapt all call sites to use the new calling way.
|
|
|
|
|
|
| |
One difference is that 'MappingNode.items()' does not strip the
provenance from scalars and lists, which ends up not affecting the
code much.
|
|
|
|
|
|
|
| |
This is to mimic the 'dict.values()' interface.
- Adapt parts of the code calling 'node_items' but ignoring the
first value to use this instead
|
|
|
|
|
| |
This mimics the dict.keys() method but returns a list instead of a
dict_keys, for cython performance reasons
|
|
|
|
|
| |
- Also add a convenience method 'safe_del' catching the exception
when we don't care if the value was there or not.
|
|
|
|
|
|
|
|
|
| |
- Adding 'get_sequence' on MappingNode to access sequences in a mapping
- Adding 'sequence_at' on SequenceNode to access sequences in a sequence
- Adding 'mapping_at' on SequenceNode to access mappings in a sequence
Using "*_at" in sequences allows us to quickly understand if we are
dealing with a sequence or a mapping.
|
|
|
|
|
|
|
|
|
|
|
| |
- 'as_bool()' casts a ScalarNode into a boolean, understanding both
'True' and 'False' as truthy-falsy values, as per node_get(type=bool)
behavior
- 'is_none()' allwos checking whether the scalar node contains a 'None'
value. Since 'None' cannot be used when working with booleans, we need
to have a way of checking for 'None' when we actually need the
information of whether the value is unset.
- Adapt all call places to use the new API
|
|
|
|
|
|
|
|
|
|
| |
- 'get_scalar()' allows retrieving a scalar node from a mapping.
- 'as_str()' casts a ScalarNode into a string (thus removing the node
information).
Both together, those replace 'node_get(mapping, key, type=str)' but
also allow retrieving the 'Node' itself, which will allow in the future
lazier provenance computation.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Update OptionEnum and OptionFlags to match the Option base-class.
Introduce 'load_special' to allow explicit usage of extended
functionality, which wouldn't necessarily be supported by different
subclasses.
By making the signatures of overridden methods deliberately match, we
can use PyLint to ensure the signatures don't accidentally differ.
Also replace `super(cls, self)` with the equivalent and less error-prone
`super()`, wherever we've touched it. In separate work we may want to
replace this across the project.
We must introduce __init__() functions for OptionEnum and OptionFlags to
get a clean pass from PyLint. It seems that it's unable to see that
load_special() is also transitively called from __init__().
|
|
|
|
|
|
|
|
|
|
| |
For most use-cases with modern Python, it's not necessary to supply the
'type' or 'object-or-type' arguments to super().
Replace all our instances with arg-less super, which is less
error-prone.
https://docs.python.org/3.5/library/functions.html#super
|
|
This was discussed in #1008.
Fixes #1009.
|