summaryrefslogtreecommitdiff
path: root/src/buildstream/types.py
Commit message (Collapse)AuthorAgeFilesLines
* Update all packages requirementsBenjamin Schubert2020-05-111-1/+1
| | | | Also fix linting errors coming with new version of pylint
* types.py: Add a __str__ to PipelineSelection to fix man pagesbschubert/fix-manpagesBenjamin Schubert2020-04-231-0/+3
| | | | | This ensures that we get as 'default' what the user needs to enter in the command in the manpages
* src: Removing all pre 2.x "Since" documentation annotations.Tristan Van Berkom2020-04-211-2/+0
| | | | | | | | | | | | | | | This does not make sense to keep in the public API surface documentation. As we are heading towards a release of 2.0, this represents a "reset" in public API, and older annotations only serve to clutter the documentation with information that is not relevant to the reader. Everything which is public at the time of the 2.0 release can be considered available "Since: 2.0" implicitly (as this is going to be the starting point of this new stable API). It will make sense to start adding these annotations again for any added API in 2.2 and forward.
* types.py: Completely remove 'Consistency'Benjamin Schubert2020-01-161-29/+0
| | | | | 'Consistency' is not needed anymore, now that we have everything in place to not use it
* element.py: Compute whether an element is cached only on `is_cached`Benjamin Schubert2020-01-161-6/+0
| | | | | | | | | | | This removes the early call to get whether sources are locally cached in `_update_source_state` by delegating it to the call of `is_cached`. Once it is cached, the element is assumed to stay that way for the duration of the pipeline, we can therefore cache the result once it is true. Also remove `Consistency.IS_CACHED`, which is not used anywhere else.
* Make PipelineSelection a proper enum typeTristan Maat2020-01-081-0/+30
| | | | | | | | | | | | | | | | | | PipelineSelection is one of the few stringy types that weren't converted to FastEnum, presumably because we lacked a mechanism for only allowing a sub-set of options as CLI arguments. We've re-designed this since, and as part of the UI/UX refactor we'd like to generally clean this, but that is probably still a while out. Since that hasn't happened, for now, this adds a feature to the FastEnumType that allows specifying only a subset of values is allowed for a specific command, so that we can use the type as a proper enum. We also get rid of a number of accidental uses of strings, and move PipelineSelection to buildstream.types so that we don't have a significant import overhead for it.
* Reformat code using BlackChandan Singh2019-11-141-1/+1
| | | | | | | 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.
* Add initial mypy configuration and typesChandan Singh2019-09-021-1/+12
| | | | | | | | | | 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).
* context: Move 'CacheBuildTrees' to a FastEnumBenjamin Schubert2019-07-291-0/+17
| | | | | | This allows removing completely the '_node_get_option_str' on context and ensures every method relying on a few set of keys set their errors consistently
* context: Move scheduler actions to an EnumBenjamin Schubert2019-07-291-0/+16
| | | | Also add helpers for the cli to be able to represent 'FastEnum' directly
* node: Add 'as_enum' on ScalarNode and 'get_enum' helper on MappingNodeBenjamin Schubert2019-07-291-0/+9
| | | | | | | | This adds a method to ensure that a value is from a set of valid values and raises an error message accordingly. - Define Enum types for each of the relevant cases - Adapt call places that were doing such things manually
* types: Mark 'Consistency' as a 'FastEnum'Benjamin Schubert2019-07-291-1/+11
| | | | | | This allows for stronger guarantees when checking the level of consistency since it will only be comparable with itself, and ensures unicity
* types: Add a 'FastEnum' implementation and replace Enum by itBenjamin Schubert2019-07-291-3/+51
| | | | | | | 'Enum' has a big performance impact on the running code. Replacing it with a safe subset of functionality removes lots of this overhead without removing the benefits of using enums (safe comparisions, uniqueness)
* element.py: Remove update_state_recursively()James Ennis2019-07-161-50/+0
| | | | | | Now that __update_ready_for_runtime() and __update_strict_cache_key_of_rdeps() have been introduced, we no longer need to recursively update the state of elements
* Move source from 'buildstream' to 'src/buildstream'Chandan Singh2019-05-211-0/+177
This was discussed in #1008. Fixes #1009.