Skip to content

owainkenwayucl/pyconfconv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyconfconv

Tools for reading python config files into R + bash

Usage

To install the scripts into your ~/bin directory type:

make install

This is not essential, although you need to have pyconfconv.py in your $PATH for pyconfconv.r to work unmodified.

At the command-line

$ pyconfconv.py -h
usage: pyconfconv.py [-h] [-i filename] [-l language] [-s section]

Convert python config files into useful formats.

optional arguments:
  -h, --help   show this help message and exit
  -i filename  Source file.
  -l language  Output language.
  -s section   Section to output.

If you do not select a section, then section names are used as prefixes for variable names with an underscore separating them.

From a bash script

To use the bash wrapper, simply source pyconfconv.sh with the right arguments, e.g.

#!/usr/bin/env bash

source `which pyconfconv.sh` examples/config.ini hosts

From an R script

To use the R wrapper, you need to make sure that pyconfconv.py is in your $PATH and, source pyconfconv.r and then eval either pyconfconverts(filename, section) or pyconfconvert(filename) depending on whether you want to pull out a section or not.

#!/usr/bin/env Rscript

source("pyconfconv.r")

eval(parse(text=pyconfconverts("examples/config.ini", "hosts")))

or for the entire file:

#!/usr/bin/env Rscript

source("pyconfconv.r")

eval(parse(text=pyconfconvert("examples/config.ini")))

About

Tools for reading python config files into R + bash

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published