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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'elements.': 0.07; 'parser': 0.07; 'subject:file': 0.07; 'parsing': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:How': 0.10; 'finney': 0.16; 'greatness': 0.16; 'measured': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:access': 0.16; 'subject:make': 0.16; 'subject:python': 0.16; 'library': 0.18; 'creating': 0.23; 'load': 0.23; 'header:User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'tried': 0.27; 'ideal': 0.29; "i'm": 0.30; 'writes:': 0.31; 'file': 0.32; 'option': 0.32; 'text': 0.33; 'could': 0.34; 'tool': 0.35; 'library.': 0.36; 'ben': 0.38; 'to:addr:python-list': 0.38; 'san': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'term': 0.63; 'skip:\xe2 10': 0.65; 'wall': 0.65; '8bit%:43': 0.74; 'subject:read': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ben Finney <ben+python@benfinney.id.au>
Subject Re: How to read a make file in python and access its elements
Date Tue, 23 Jul 2013 09:14:08 +1000
References <beec5587-f154-47ed-b5f9-d548428d4da5@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host rasputin.madmonks.org
X-Public-Key-ID 0xBD41714B
X-Public-Key-Fingerprint 9CFE 12B0 791A 4267 887F 520C B7AC 2E51 BD41 714B
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-gpg.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)
Cancel-Lock sha1:Bv/JewScvUFTlfo/eAYyHNTG+UQ=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4989.1374534863.3114.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1374534863 news.xs4all.nl 15959 [2001:888:2000:d::a6]:57571
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51061

Show key headers only | 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