A buildout config file normalizer
Project description
collective.normalize_buildout
Do you have multiple buildouts and you want an easy way to apply new best practices to each buildout in a simple way, but you cannot, because every buildout file is configured slightly different?
Then this package is for you. The normalize_buildout is a script that will normalize your buildout file.
The tool sorts sections and the keys in each section alphabetically, also some special multi line values, like eggs.
Features
normalize_buildout by default will replace the given config file in place. It has a command line option for not changing the file and only reporting via exit code if the file is not normalized. This can easily be integrated in check tools or ci tools.
The script understands the special meaning of some sections and keys:
buildout section is always the first
versions section is always the last
recipe key is always first
eggs, and zcml values get sorted.
keys of sources entries get sorted, values get indented so that branch settings are all on the same column.
Comments above sections and above keys get shuffled together with key or section. You can document why you need to pin a specific version of a package and after normalization, the comment is still above the right version specifier. - Can be bullet points
Installation
You can install the package with pip or zc.buildout.
PIP:
$ pip install collective.normalize_buildout
Buildout:
[buildout] ... [extras] recipe = zc.recipe.egg eggs = collective.normalize_buildout
and then running “bin/buildout”
Usage
You can do three things with this command.
Check if a config file is normalized (for CI):
$ normalize_buildout -c buildout.cfg
This will either return nothing, or a warning that the buildout is not normalized. It will have a falsy return code for CI.
Normalize a config file in place:
$ normalize_buildout buildout.cfg
This will normalize the buildout file.
Read a config file from stdin and print it on stdout, useful in vim:
:%!normalize_buildout -
On failure, this command will print out the config file unmodified.
Contribute
Contributors
Patrick Gerken, patrick.gerken@zumtobelgroup.com
Changelog
0.2.0 (2015-09-11)
Support piping. [do3cc]
Remove unneeded dependency. [do3cc]
Fix 3 bugs resulting in bad buildout.cfgs. [do3cc]
0.1 (2015-09-10)
Initial release. [do3cc]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for collective.normalize_buildout-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 954abf4f6cb69f6e917f9fa5c5d56ea0835afc0a1227e23a6529cf48900cf0ab |
|
MD5 | 30fb8e38c967d849d63ddf4e43d4ef82 |
|
BLAKE2b-256 | db21ed8eff4f02c0f38718b66563b8efece6e2814deb8498b4ce0ed4cd2eadaf |