DIRAC cfg files reader
Project description
Parser for DIRAC cfg files
diraccfg
provides a parser for the configuration files used by
DIRAC and its associated projects.
Installation
pip install diraccfg
Command line usage
The command line mode of diraccfg
primarily serves to convert the
configuration into a JSON file which can then be processed using standard tools
such as jq
.
The following examples are ran using the following configuration file:
DefaultModules = DIRAC
Sources
{
DIRAC = git://github.com/DIRACGrid/DIRAC.git
}
Releases
{
integration
{
Modules = DIRAC, WebAppDIRAC, VMDIRAC
Externals = v6r6p8
DIRACOS = master
}
v7r0-pre19
{
Modules = DIRAC, VMDIRAC:v2r4-pre2, RESTDIRAC:v0r5, COMDIRAC:v0r17, WebAppDIRAC:v4r0p7, OAuthDIRAC:v0r1-pre1
DIRACOS = master
}
v6r22p2
{
Modules = DIRAC, VMDIRAC:v2r4-pre2, RESTDIRAC:v0r6, COMDIRAC:v0r17, WebAppDIRAC:v4r0p7, OAuthDIRAC:v0r1-pre1
Externals = v6r6p8
DIRACOS = v1r3
}
v6r22p1
{
Modules = DIRAC, VMDIRAC:v2r4-pre2, RESTDIRAC:v0r6, COMDIRAC:v0r17, WebAppDIRAC:v4r0p7, OAuthDIRAC:v0r1-pre1
Externals = v6r6p8
DIRACOS = v1r3
}
}
Print as JSON
$ diraccfg as-json example.cfg
{"DefaultModules": "DIRAC", "Sources": {"DIRAC": "git://github.com/DIRACGrid/DIRAC.git"}, "Releases": {"integration": {"Modules": "DIRAC, WebAppDIRAC, VMDIRAC", "Externals": "v6r6p8", "DIRACOS": "master"}, "v7r0-pre19": {"Modules": "DIRAC, VMDIRAC:v2r4-pre2, RESTDIRAC:v0r5, COMDIRAC:v0r17, WebAppDIRAC:v4r0p7, OAuthDIRAC:v0r1-pre1", "DIRACOS": "master"}, "v6r22p2": {"Modules": "DIRAC, VMDIRAC:v2r4-pre2, RESTDIRAC:v0r6, COMDIRAC:v0r17, WebAppDIRAC:v4r0p7, OAuthDIRAC:v0r1-pre1", "Externals": "v6r6p8", "DIRACOS": "v1r3"}, "v6r22p1": {"Modules": "DIRAC, VMDIRAC:v2r4-pre2, RESTDIRAC:v0r6, COMDIRAC:v0r17, WebAppDIRAC:v4r0p7, OAuthDIRAC:v0r1-pre1", "Externals": "v6r6p8", "DIRACOS": "v1r3"}}}
Extract available releases with using jq
$ diraccfg as-json example.cfg | jq '.Releases'
{
"integration": {
"Modules": "DIRAC, WebAppDIRAC, VMDIRAC",
"Externals": "v6r6p8",
"DIRACOS": "master"
},
"v7r0-pre19": {
"Modules": "DIRAC, VMDIRAC:v2r4-pre2, RESTDIRAC:v0r5, COMDIRAC:v0r17, WebAppDIRAC:v4r0p7, OAuthDIRAC:v0r1-pre1",
"DIRACOS": "master"
},
"v6r22p2": {
"Modules": "DIRAC, VMDIRAC:v2r4-pre2, RESTDIRAC:v0r6, COMDIRAC:v0r17, WebAppDIRAC:v4r0p7, OAuthDIRAC:v0r1-pre1",
"Externals": "v6r6p8",
"DIRACOS": "v1r3"
},
"v6r22p1": {
"Modules": "DIRAC, VMDIRAC:v2r4-pre2, RESTDIRAC:v0r6, COMDIRAC:v0r17, WebAppDIRAC:v4r0p7, OAuthDIRAC:v0r1-pre1",
"Externals": "v6r6p8",
"DIRACOS": "v1r3"
}
}
Get a sorted list of stable version numbers
$ diraccfg as-json example.cfg | jq '.Releases' | diraccfg sort-versions
["v6r22p2", "v6r22p1"]
Get a sorted list of version numbers including prereleases
$ diraccfg as-json example.cfg | jq '.Releases' | diraccfg sort-versions --allow-pre-releases
["v7r0-pre19", "v6r22p2", "v6r22p1"]
Find the latest releases
$ diraccfg as-json example.cfg | jq '.Releases' | diraccfg sort-versions | jq -r '.[0]'
v6r22p2
$ diraccfg as-json example.cfg | jq '.Releases' | diraccfg sort-versions --allow-pre-releases | jq -r '.[0]'
v7r0-pre19
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
diraccfg-1.0.1.tar.gz
(37.5 kB
view hashes)
Built Distribution
Close
Hashes for diraccfg-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5103e25208fd41c623a72ddd5775416633f97b376531c86fb4e79282871db218 |
|
MD5 | eece3b7ede431001420ae89e36465d78 |
|
BLAKE2b-256 | 9f90279f55fff9481f9e0424c3c97b24dc10004ec8d8f98ddf5afd07a7b79194 |