summaryrefslogtreecommitdiff
path: root/src/buildstream/_options
Commit message (Collapse)AuthorAgeFilesLines
* Completely abolish job pickling.tristan/nuke-pickle-jobberTristan van Berkom2020-06-151-11/+0
|
* option.py: Remove 'transform' flag. It is not needed anymoreBenjamin Schubert2020-05-125-20/+9
| | | | | Now that we handle variable transformation more globally, we don't need the transform value anymore
* exceptions: Expose ErrorDomain, ErrorLoadReasonThomas Coldrick2020-01-235-5/+10
| | | | | | | 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.
* Reformat code using BlackChandan Singh2019-11-148-71/+85
| | | | | | | 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.
* _options/option.py: Pass the node instead of the str to 'transform'Benjamin Schubert2019-10-163-5/+8
| | | | | | | 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.
* Add initial mypy configuration and typesChandan Singh2019-09-021-1/+6
| | | | | | | | | | 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).
* optionpool: Use 'get_enum' for getting the option typeBenjamin Schubert2019-07-291-7/+12
| | | | This improves the consistency of our error reporting
* optionpool: make OptionPool picklableAngelos Evripiotis2019-07-241-3/+18
| | | | | 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.
* _exceptions.py: Align LoadError() parameter orderingtpollard/loaderrorTom Pollard2019-07-185-36/+32
| | | | | | All of the errors which subclass from BstError have their first positional argument as message, LoadError should follow this ordering for consistency.
* node: Add 'get_str_list' on 'MappingNode'Benjamin Schubert2019-07-172-2/+2
| | | | | | `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
* node: make 'assert_symbol_name' privateBenjamin Schubert2019-07-152-4/+4
| | | | This is not needed for plugins and should therefore not be public
* _yaml: Split Node-related parts into 'node.pyx'Benjamin Schubert2019-07-152-9/+9
| | | | | This makes the 'Node' API public, and available for use directly for plugins.
* _yaml: Set 'MappingNode' public-private APIBenjamin Schubert2019-07-151-1/+1
| | | | | | | - _composite -> __composite (internal) - composite -> _composite (BuildStream private) - composite_under -> _composite_under (BuildStream private) - get -> _get (internal)
* _yaml: Remove 'node_get_provenance' and add 'Node.get_provenance'Benjamin Schubert2019-07-154-27/+32
| | | | | | | | 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
* _yaml: rework 'assert_symbol_names' to not require provenanceBenjamin Schubert2019-07-152-4/+2
| | | | | Now that we get scalar Nodes, it is easier to just give the node and extract the provenance as needed.
* _yaml: Remove 'indices' from 'node_get_provenance'Benjamin Schubert2019-07-152-12/+8
| | | | | | | | | 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
* _yaml: Remove 'node_validate' and replace by 'MappingNode.validate_keys'Benjamin Schubert2019-07-153-4/+3
| | | | - adapt all call sites to use the new API
* _yaml: Move 'node_composite' to a method on 'MappingNode'Benjamin Schubert2019-07-151-1/+1
| | | | | - Also take care of node_composite_move in the same way. - Adapt all calling places
* _yaml: Remove 'node_set'. Now use __setitem__Benjamin Schubert2019-07-151-1/+1
| | | | | | - Implement __setitem__ on 'MappingNode' - Implement __setitem__ on 'SequenceNode' - Adapt all call sites to use the new calling way.
* _yaml: Remove 'node_items' and add 'MappingNode.items()'Benjamin Schubert2019-07-151-3/+3
| | | | | | One difference is that 'MappingNode.items()' does not strip the provenance from scalars and lists, which ends up not affecting the code much.
* _yaml: Introduce 'MappingNode.values()'Benjamin Schubert2019-07-151-5/+7
| | | | | | | 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
* _yaml: Remove 'node_keys' and add 'MappingNode.keys' to replace itBenjamin Schubert2019-07-151-1/+1
| | | | | This mimics the dict.keys() method but returns a list instead of a dict_keys, for cython performance reasons
* _yaml: Remove 'node_del' and support `del mapping[key]`Benjamin Schubert2019-07-151-1/+1
| | | | | - Also add a convenience method 'safe_del' catching the exception when we don't care if the value was there or not.
* _yaml: Introduce 'get_sequence()' and 'sequence_at()'/'mapping_at()'Benjamin Schubert2019-07-153-5/+5
| | | | | | | | | - 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.
* _yaml: Add 'as_bool()' and 'is_none()' to ScalarNodeBenjamin Schubert2019-07-151-2/+2
| | | | | | | | | | | - '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
* _yaml: Add 'as_str()' on ScalarNode and 'get_scalar()' on MappingNodeBenjamin Schubert2019-07-154-9/+7
| | | | | | | | | | - '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.
* Option: rm unused self.descriptionAngelos Evripiotis2019-07-091-2/+5
|
* _options: match methods to base classAngelos Evripiotis2019-06-185-5/+19
| | | | | | | | | | | | | | | | | | | 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__().
* Refactor 'super(cls, self)' -> 'super()'aevri/supersuperAngelos Evripiotis2019-06-126-6/+6
| | | | | | | | | | 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
* Move source from 'buildstream' to 'src/buildstream'Chandan Singh2019-05-219-0/+819
This was discussed in #1008. Fixes #1009.