How to read a make file in python and access its elements

alex23 wuwei23 at gmail.com
Tue Jul 23 02:48:30 CEST 2013


On 23/07/2013 5:09 AM, san wrote:
> How to read/load  the cmake file in python and access its elements.
> I have a scenario, where i need to load the make file and access its elements.
> I have tried reading the make file as text file and parsing it,but its not the ideal solution
> Please let me know how to load the .mk file and access its elements in python.

Take a look at pymake:

"make.py (and the pymake modules that support it) are an implementation 
of the make tool which are mostly compatible with makefiles written for 
GNU make."

http://hg.mozilla.org/users/bsmedberg_mozilla.com/pymake/

There is a parser.py file which might be useful to you.




More information about the Python-list mailing list