summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* element: Move __expand_splits to cythonbschubert/optimize-splitsBenjamin Schubert2019-07-155-22/+37
| | | | | | | | | __expand_splits is a somewhat intensive method, that represents >1% of the runtime. Moving it to cython makes it 5 times faster. This also requires exporting some 'Variables' symbols as public.
* element: Add helper to get dependencies for a list of elements in a scopeBenjamin Schubert2019-07-154-47/+60
| | | | | | This allows us to remove the checks about 'visited' sets that were sometimes used or not and allows us to open this for plugins that might want this functionality
* element: optimize getting dependencies in cythonBenjamin Schubert2019-07-153-59/+74
| | | | This makes the dependency code roughly 8x faster
* element: Rewrite 'dependencies()' to be more optimalBenjamin Schubert2019-07-151-29/+37
| | | | | This reduces the number of comparison we need to make and reduces the runtime cost of this method by roughly 25%
* NEWS: update for new Node APIBenjamin Schubert2019-07-151-14/+7
|
* plugins: Update public documentation to be correct with the new NodesBenjamin Schubert2019-07-153-9/+9
| | | | | We need to update every place where we were passing a yaml 'dict' to now pass a 'MappingNode'
* node: Document buildstream-private API and remove unused parameterBenjamin Schubert2019-07-153-3/+108
| | | | | _create_new_file did not use the 'toplevel' parameter, we can therefore remove it.
* node: document public APIBenjamin Schubert2019-07-152-28/+462
|
* node: Make error messages more user-friendlyBenjamin Schubert2019-07-151-4/+12
| | | | | Users should not have to know anything about nodes, and should be greeted by commonly defined yaml types.
* node: Rename 'copy' to 'clone'Benjamin Schubert2019-07-158-30/+30
| | | | | | | | A 'clone' operation has an implicit understanding that it is expensive, which is not the case of a 'copy' operation, which is more usually a shallow copy. Therefore renaming to 'clone'
* node: use 'pop' instead of 'del' for safe_delBenjamin Schubert2019-07-151-4/+1
| | | | | This reduces slightly the amount of C code needed and makes the run marginally faster
* node: Mark module-private functions and classes with '__'Benjamin Schubert2019-07-151-56/+56
| | | | | This way, it is easier to know what is BuildStream-private from what is module-private
* node: Mark `MappingNode._get` as privateBenjamin Schubert2019-07-152-18/+18
|
* node: make 'assert_symbol_name' privateBenjamin Schubert2019-07-155-25/+25
| | | | This is not needed for plugins and should therefore not be public
* _yaml: Split Node-related parts into 'node.pyx'Benjamin Schubert2019-07-1523-1041/+1118
| | | | | This makes the 'Node' API public, and available for use directly for plugins.
* Reorganize methods in Node classesBenjamin Schubert2019-07-152-196/+260
|
* _yaml: Mark 'strip_node_info' as buildstream-privateBenjamin Schubert2019-07-159-18/+18
|
* _yaml: Mark new_syntethic_file as BuildStream privateBenjamin Schubert2019-07-152-2/+2
|
* _yaml: Set 'MappingNode' public-private APIBenjamin Schubert2019-07-1510-42/+42
| | | | | | | - _composite -> __composite (internal) - composite -> _composite (BuildStream private) - composite_under -> _composite_under (BuildStream private) - get -> _get (internal)
* _yaml: Move '__contains__' to MappingNodeBenjamin Schubert2019-07-151-6/+3
| | | | | This method is only ever used in this context and should not be on the base Node anyways
* _yaml: Mark attributes in ProvenanceInformation as Buildstream-privateBenjamin Schubert2019-07-156-44/+47
| | | | | Users should not need to get access to any of those, and should only need access to the ProvenanceInformation to print it.
* _yaml: Remove code duplication on '_new_node_from_*'Benjamin Schubert2019-07-151-17/+5
|
* plugin: remove 'node_get_provenance', use the Node API directlyBenjamin Schubert2019-07-154-24/+9
|
* _yaml: Remove 'node_get_provenance' and add 'Node.get_provenance'Benjamin Schubert2019-07-1524-121/+115
| | | | | | | | 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-155-11/+11
| | | | | Now that we get scalar Nodes, it is easier to just give the node and extract the provenance as needed.
* _project: remove 'key' argument from 'get_path_from_node'Benjamin Schubert2019-07-154-14/+18
| | | | | | | 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 'indices' from 'node_get_provenance'Benjamin Schubert2019-07-155-29/+29
| | | | | | | | | 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
* types: rework dependency to always get a 'Node' as dep and remove provenanceBenjamin Schubert2019-07-151-9/+4
| | | | | The provenance can be constructed afterwards, so we don't need to pre-calculate it.
* _yaml: Use __cinit__ and __new__ to create node more effectivelyBenjamin Schubert2019-07-151-27/+34
| | | | | | | Cython can bypass the normal python mechanism to create new objects, which makes their instantation faster. See https://cython.readthedocs.io/en/latest/src/userguide/extension_types.html#fast-instantiation for more details.
* _yaml: Move 'value' of Node in each sub nodeBenjamin Schubert2019-07-153-39/+71
| | | | | | | | This allows us to type its value more strictly, allowing for more efficient access. - Also implement 'node_at' on 'SequenceNode', to allow some tests to test some internals generically.
* _yaml: Mark attributes on 'Node' as private (only c-accessible)Benjamin Schubert2019-07-152-4/+6
| | | | | This ensures that we are not breaking our encapsulation and that the modules accessing 'Node' from C are correctly typed.
* _yaml: Remove 'is_node', which is not used in the codebase anymoreBenjamin Schubert2019-07-151-20/+0
| | | | | A direct replacement would be isinstance(obj, MappingNode) if someone really needs it.
* _yaml: Remove 'node_validate' and replace by 'MappingNode.validate_keys'Benjamin Schubert2019-07-1530-103/+71
| | | | - adapt all call sites to use the new API
* _yaml: Create 'from_dict' on Node and remove node creation methodsBenjamin Schubert2019-07-159-53/+17
| | | | | | | Using 'Node.from_dict({})' can replace new_empty_node, and the rest is not needed anymore. - Adapt all call sites
* _yaml: Remove 'node_extend_list' and add 'SequenceNode.append'Benjamin Schubert2019-07-154-80/+16
| | | | | | | There was a single place using 'node_extend_list', which we can replace more easily with 'SequenceNode.append'. Also rewrite _projectrefs.py:_lookup to use the new API more effectively
* _yaml: Refer new synthetic nodes to their parentsBenjamin Schubert2019-07-151-19/+22
| | | | | | | | | This changes how we were handling synthetic nodes. Previously, we would have them as coming from a 'SYNTHETIC_FILE'. This is not correct when we need the position in the real file when adding new information to a file we will end up writing to disk (like project_ref). This is a prerequisite for further work on cleaning how it is done.
* _yaml: Add a 'from_dict' on Node to create new nodes from dictsBenjamin Schubert2019-07-154-18/+22
| | | | | | | This new methods is here to replace the previous 'new_node_from_dict' that will be moved to a private method. Adapt all call sites to use the new 'from_dict' method.
* _yaml: Move 'node_composite' to a method on 'MappingNode'Benjamin Schubert2019-07-1510-68/+64
| | | | | - Also take care of node_composite_move in the same way. - Adapt all calling places
* _yaml: move 'composite_dict' to 'MappingNode' as '_composite'Benjamin Schubert2019-07-152-18/+14
|
* _yaml: Extract parts of 'composite_dict' to each type of 'Node'Benjamin Schubert2019-07-152-49/+62
| | | | | | We had a large if-else clause in 'composite_dict' that was looking at the type of the source and acting based on that. This is easier to handle once split on each type of 'Node'
* _yaml: Move actual composition logic to MappingNodeBenjamin Schubert2019-07-152-67/+51
|
* _yaml: move 'is_composite_list' as a Node memberBenjamin Schubert2019-07-152-44/+48
|
* tests/yaml: Stop using 'composite_dict' and use 'composite' insteadBenjamin Schubert2019-07-152-8/+8
| | | | | 'composite_dict' is a more internal method and we don't really need to access it there
* _yaml: Move 'node_final_assertions' to 'Node._assert_fully_composited'Benjamin Schubert2019-07-156-58/+47
|
* _yaml: remove node_sanitizeBenjamin Schubert2019-07-157-71/+20
| | | | | | | | | Some call places do not need calls to 'node_sanitize' anymore, therefore removing the call entirely. Other still use it for convenience, but that doesn't seem the right way to do it for consistency. Those places have been replaced by calls to 'Node.strip_node_info()'.
* _yaml: Decomission 'dump()'. 'roundtrip_dump' is an equivalent function nowBenjamin Schubert2019-07-156-22/+7
| | | | | Remove completely '_yaml.dump()' and replace all notions and call by 'roundtrip_dump'
* tests: Change all calls to _yaml.dump to _yaml.rountrip_dumpBenjamin Schubert2019-07-1568-315/+296
| | | | | Now that both are equivalent, we can skip the sanitization part before the yaml call.
* _yaml: Automatically represent Yaml nodes into yamlBenjamin Schubert2019-07-151-2/+16
| | | | | This removes the need of calling _yaml.dump(), as roundtrip_dump is now equivalent.
* _yaml: Stop stringifying manually in roundtrip_dumpBenjamin Schubert2019-07-151-27/+14
| | | | | | This removes the need of manually stringifying the values in roundtrip_dump by registering special Ruamel representer for each value we might expect.
* _cachekey: Remove the 'node_sanitization' done before the json stringBenjamin Schubert2019-07-157-7/+26
| | | | | | | | Since ujson already sorts the keys, we just need to be able to jsonify Nodes sensibly. This is done by implementing __json__ on the 'Node' base class. This does not break the cache keys.