summaryrefslogtreecommitdiff
path: root/src/buildstream/plugin.py
Commit message (Collapse)AuthorAgeFilesLines
* Add initial mypy configuration and typesChandan Singh2019-09-021-40/+57
| | | | | | | | | | 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).
* _message.py: Use element_name & element_key instead of unique_idtpollard/messageobjectTom Pollard2019-08-081-4/+9
| | | | | | | | | | | | | Adding the element full name and display key into all element related messages removes the need to look up the plugintable via a plugin unique_id just to retrieve the same values for logging and widget frontend display. Relying on plugintable state is also incompatible if the frontend will be running in a different process, as it will exist in multiple states. The element full name is now displayed instead of the unique_id, such as in the debugging widget. It is also displayed in place of 'name' (i.e including any junction prepend) to be more informative.
* plugin.py: cache full_name member in __init__Tom Pollard2019-08-081-7/+22
| | | | | | Once project & type are resolved, the full_name can be computed and cached for efficiency. The accessor for getting the private member should also be moved to the correct section.
* Make ChildJobs and friends picklableAngelos Evripiotis2019-07-241-0/+25
| | | | | | | | | Pave the way toward supporting the 'spawn' method of creating jobs, by adding support for pickling ChildJobs. Introduce a new 'jobpickler' module that provides an entrypoint for this functionality. This also makes replays of jobs possible, which has made the debugging of plugins much easier for me.
* plugins: Update public documentation to be correct with the new NodesBenjamin Schubert2019-07-151-2/+2
| | | | | We need to update every place where we were passing a yaml 'dict' to now pass a 'MappingNode'
* plugin: remove 'node_get_provenance', use the Node API directlyBenjamin Schubert2019-07-151-16/+0
|
* _yaml: Remove 'node_get_provenance' and add 'Node.get_provenance'Benjamin Schubert2019-07-151-2/+1
| | | | | | | | 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
* _project: remove 'key' argument from 'get_path_from_node'Benjamin Schubert2019-07-151-4/+3
| | | | | | | Now that we have scalar nodes, we can directly give the scalar to the method. - Adapt the plugin method to also not access via the key
* _yaml: Remove 'node_validate' and replace by 'MappingNode.validate_keys'Benjamin Schubert2019-07-151-26/+1
| | | | - adapt all call sites to use the new API
* _yaml: Create 'from_dict' on Node and remove node creation methodsBenjamin Schubert2019-07-151-20/+0
| | | | | | | Using 'Node.from_dict({})' can replace new_empty_node, and the rest is not needed anymore. - Adapt all call sites
* _yaml: Remove 'node_set'. Now use __setitem__Benjamin Schubert2019-07-151-22/+0
| | | | | | - 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-19/+2
| | | | | | One difference is that 'MappingNode.items()' does not strip the provenance from scalars and lists, which ends up not affecting the code much.
* element: Remove `node_get_member` and all references to itBenjamin Schubert2019-07-151-38/+1
| | | | This can now be done more easily with the Node api
* plugin: remove 'node_get_list_element'Benjamin Schubert2019-07-151-37/+1
| | | | | | | The new yaml API is able of getting these access with the same error messages handling. Having this helper is therefore not useful anymore.
* element: remove 'node_subst_list_element'Benjamin Schubert2019-07-151-2/+1
| | | | | This method is unused and can be easily reimplemented with the new Node API by looping over nodes.
* _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
* Refactor, use context.messenger directlyAngelos Evripiotis2019-07-051-6/+6
| | | | | | Instead of having methods in Context forward calls on to the Messenger, have folks call the Messenger directly. Remove the forwarding methods in Context.
* NEWS: restrict `Plugin.node_items` to be called on `Node`s.bschubert/stricter-node-apiBenjamin Schubert2019-06-071-3/+3
| | | | | Also update documentation in plugin for APIs that do accept Node and not `dict`.
* Move source from 'buildstream' to 'src/buildstream'Chandan Singh2019-05-211-0/+929
This was discussed in #1008. Fixes #1009.