summaryrefslogtreecommitdiff
path: root/src/buildstream/plugin.py
Commit message (Collapse)AuthorAgeFilesLines
* element.py: Fix documentation around `node` usagebschubert/fix-node-docsBenjamin Schubert2020-05-111-1/+1
|
* plugin.py: Rework how deprecation warnings are configured.Tristan Van Berkom2020-05-041-31/+8
| | | | | | | | | | | | | | | | | This is mostly a semantic change which defines how deprecation warnings are suppressed in a more consistent fashion, by declaring such suppressions in the plugin origin declarations rather than on the generic element/source configuration overrides section. Other side effects of this commit are that the warnings have been enhanced to include the provenance of whence the deprecated plugins have been used in the project, and that the custom deprecation message is optional and will appear in the message detail string rather than in the primary warning text, which now simply indicates that the plugin being used is deprecated. Documentation and test cases are updated. This fixes #1291
* plugin.py/pluginfactory.py: Implementing BST_MIN_VERSIONTristan Van Berkom2020-04-291-0/+26
| | | | | | | | | | | | | | The BST_MIN_VERSION guards assert that the BuildStream core which loaded the plugin is compatible with the plugin itself. This commit adds BST_MIN_VERSION to the base plugin.py with documentation informing Plugin authors how to set the minimum version, and also adds the assertions at plugin loading time in pluginfactory.py. This commit also: * Adds the BST_MIN_VERSION specification to all current core plugins * Adds the BST_MIN_VERSION specification to plugins used in test cases
* Plugin loading refactor, removing all versioningTristan Van Berkom2020-04-291-21/+0
| | | | | | | | | | | | | | | | Plugin format versioning was decided to be removed for local plugins and any plugins for which we do not load an explicitly provided plugin. For pip, this will be handled with a standard distutils/setuptools approach, allowing users to specify pip style version boundaries in the plugin origins. This patch refactors plugin loading so that all related code goes into the private _pluginfactory module, a new small PluginOrigin type was added to better manipulate loaded origins. Test cases have been removed and will be readded in a following commit, adjusted to new expectations.
* Remove documentation references to format_versionTristan Van Berkom2020-04-251-4/+0
| | | | | | | | | | | With BuildStream 2.0, we start with a fresh API, everything that is present at the time of the 2.0 release can implicitly be considered to be available since 2.0. In the future, we will be expressing new API additions using the min-version semantic versioning style instead of format version too (so new YAML configurations will be expressed as "since: 2.2" and so on).
* src: Removing all pre 2.x "Since" documentation annotations.Tristan Van Berkom2020-04-211-5/+2
| | | | | | | | | | | | | | | 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.
* source.py: Remove 'get_consistency' completelyBenjamin Schubert2020-01-161-2/+2
| | | | | This is not needed now that we have 'is_resolved' and 'is_cached'. We can therefore drop all calling places and implementations of it.
* Reformat code using BlackChandan Singh2019-11-141-60/+58
| | | | | | | 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.
* job pickling: plugins don't return their factoriesAngelos Evripiotis2019-10-251-5/+4
| | | | | | | | | Remove the need for plugins to find and return the factory they came from. Also take the opportunity to combine source and element pickling into a single 'plugin' pickling path. This will make it easier for us to later support pickling plugins from the 'first_pass_config' of projects.
* 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.