Skip to main content

DIRAC cfg files reader

Project description

Parser for DIRAC cfg files

CI PyPI Conda-Forge

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.0.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

diraccfg-1.0.0-py2.py3-none-any.whl (24.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file diraccfg-1.0.0.tar.gz.

File metadata

  • Download URL: diraccfg-1.0.0.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for diraccfg-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d814cb4730d697aa21095ebaa22a461ac7356f348957569eb048d6c8f1d2dcba
MD5 8179ede483e5f4dbae7426438fda7260
BLAKE2b-256 1fd17975fa6e1b4d2db69f49b61ebd44c5dd8b3fde190e8ea676d08cb719a6c2

See more details on using hashes here.

File details

Details for the file diraccfg-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: diraccfg-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for diraccfg-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5395088e2871ab8cf726fd113c931f07eb62eeee6ff9115e9c30fbb212ae56c3
MD5 fb8d20313d3d4d7b93347c2940916c7b
BLAKE2b-256 b6154bda82c2d1876b68a52b1452a6b45d58b3224477c257fc8c2e987ffd0db6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page