I have not found anything of this sort on Google and would like to know if there is a quicker way of doing the following:
I need to parse build scripts for Java programs which are written in Python. More specifically, I want to parse the dictionaries which are hard-coded into these build scripts.
For example, these scripts contain entries like:
config = {}
config["Project"] = \
{
"Name" : "ProjName",
"Version" : "v2",
"MinimumPreviousVersion" : "v1",
}
def actualCode ():
# Some code that actually compiles the relevant files
(The actual compiling is done via a call to another program, this script just sets the required options which I want to extract). For example, I want to extract, "Name"="ProjName" and so on.
I am aware of the ConfigParser library which is part of Python, but that was designed for .ini files and hence has problems (throws exception and crashes) with actual python code which may appear in the build scripts which I am talking about. So using this library would mean that I would first have to read the file in and remove lines of the file which ConfigParser would object to.
Is there a quicker way than reading the config file in as a normal file and parsing it? I am looking for libraries which can do this. I don't mind too much which languages this libraries is in.