How to read a make file in python and access its elements
Ben Finney
ben+python at benfinney.id.au
Mon Jul 22 19:14:08 EDT 2013
san <santosh.ssit at gmail.com> writes:
> I have a scenario, where i need to load the make file and access its
> elements.
What do you mean by “elements” of a make file? Is that a term with a
specific meaning, or do you mean some particular parts of the make file?
> I have tried reading the make file as text file and parsing it,but its
> not the ideal solution
You might be interested in using a library purpose-built for creating a
parser <URL:http://pyparsing.wikispaces.com/>.
I'm not aware of any makefile-syntax-aware tool for Python. Your best
option could be to write your own parser using the above library.
--
\ “True greatness is measured by how much freedom you give to |
`\ others, not by how much you can coerce others to do what you |
_o__) want.” —Larry Wall |
Ben Finney
More information about the Python-list
mailing list