-
- Downloads
bst-fmt: Allow greater control over order
Allow authors of plugins to utilise the Plugin.keyorder attribute to define an order for the sub-headers in config. Modify `bst fmt` to modify the yaml into that order. Add canonical keyorder for every plugin already in core. In terms of implementation, this adds a custom yaml dumper subclassed from ruamel.yaml's RoundTripDumper, which will dump a dict in the order defined in the keyorder attribute. The Plugin class is given a keyorder attribute, which defines the order in which keys should be dumped. The element and source classes add the common fields used in them, so as to minimise work for plugin authors. Plugin authors should add their custom keys at configure time. This causes some stripping of comments, which seems to be due to a bug in the ruamel.yaml RoundTripDumper, as that also strips the same comments. It also will remove blank spaces, again probably due to limitations in ruamel.
Showing
- buildstream/_yaml.py 27 additions, 2 deletionsbuildstream/_yaml.py
- buildstream/buildelement.py 1 addition, 0 deletionsbuildstream/buildelement.py
- buildstream/element.py 16 additions, 1 deletionbuildstream/element.py
- buildstream/plugin.py 2 additions, 0 deletionsbuildstream/plugin.py
- buildstream/plugins/elements/compose.py 2 additions, 0 deletionsbuildstream/plugins/elements/compose.py
- buildstream/plugins/elements/filter.py 2 additions, 0 deletionsbuildstream/plugins/elements/filter.py
- buildstream/plugins/elements/junction.py 1 addition, 0 deletionsbuildstream/plugins/elements/junction.py
- buildstream/plugins/elements/script.py 1 addition, 0 deletionsbuildstream/plugins/elements/script.py
- buildstream/plugins/sources/_downloadablefilesource.py 2 additions, 0 deletionsbuildstream/plugins/sources/_downloadablefilesource.py
- buildstream/plugins/sources/bzr.py 2 additions, 0 deletionsbuildstream/plugins/sources/bzr.py
- buildstream/plugins/sources/git.py 2 additions, 0 deletionsbuildstream/plugins/sources/git.py
- buildstream/plugins/sources/local.py 1 addition, 0 deletionsbuildstream/plugins/sources/local.py
- buildstream/plugins/sources/ostree.py 1 addition, 0 deletionsbuildstream/plugins/sources/ostree.py
- buildstream/plugins/sources/patch.py 1 addition, 0 deletionsbuildstream/plugins/sources/patch.py
- buildstream/plugins/sources/pip.py 1 addition, 0 deletionsbuildstream/plugins/sources/pip.py
- buildstream/plugins/sources/remote.py 1 addition, 0 deletionsbuildstream/plugins/sources/remote.py
- buildstream/plugins/sources/tar.py 1 addition, 0 deletionsbuildstream/plugins/sources/tar.py
- buildstream/plugins/sources/zip.py 1 addition, 0 deletionsbuildstream/plugins/sources/zip.py
- buildstream/source.py 3 additions, 1 deletionbuildstream/source.py
Loading
Please register or sign in to comment