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.
It is designed to be usable as either a full Python package or as a standalone
file, which can be found in src/diraccfg/cfg.py
.
The standalone mode allows for this to be used by dirac-install
and the pilot
scripts without requiring of pip
.
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
Built Distribution
File details
Details for the file diraccfg-0.2.2.tar.gz
.
File metadata
- Download URL: diraccfg-0.2.2.tar.gz
- Upload date:
- Size: 30.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bace33e419c0a797d5e29b327d65f8df379e9337db98810a0a562d0ffc5c7c95 |
|
MD5 | be8b1a4aba98526248963403e79d8cd9 |
|
BLAKE2b-256 | 774e5d4f2b6d487a7a469954997567bb571de77c96a970349fda821982c538d7 |
File details
Details for the file diraccfg-0.2.2-py2.py3-none-any.whl
.
File metadata
- Download URL: diraccfg-0.2.2-py2.py3-none-any.whl
- Upload date:
- Size: 23.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9df75d8d4b3b42f2547acb6ade32f20deab3178d9b513638403052c93753b65 |
|
MD5 | ca25c43560173d791a1887755e7e31c0 |
|
BLAKE2b-256 | 6f69a02978b0e66db9b3fe94727c71854178b16716dcd396ce8bd79e1988dbd5 |