Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51061

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

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: How to read a make file in python and access its elements
Date 2013-07-23 09:14 +1000
References <beec5587-f154-47ed-b5f9-d548428d4da5@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.4989.1374534863.3114.python-list@python.org> (permalink)

Show all headers | View raw


san <santosh.ssit@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to read a make file in python and access its elements san <santosh.ssit@gmail.com> - 2013-07-22 12:09 -0700
  Re: How to read a make file in python and access its elements Ben Finney <ben+python@benfinney.id.au> - 2013-07-23 09:14 +1000
  Re: How to read a make file in python and access its elements Dave Angel <davea@davea.name> - 2013-07-22 20:39 -0400
  Re: How to read a make file in python and access its elements alex23 <wuwei23@gmail.com> - 2013-07-23 10:48 +1000

csiph-web