Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51056 > unrolled thread
| Started by | san <santosh.ssit@gmail.com> |
|---|---|
| First post | 2013-07-22 12:09 -0700 |
| Last post | 2013-07-23 10:48 +1000 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.python
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
| From | san <santosh.ssit@gmail.com> |
|---|---|
| Date | 2013-07-22 12:09 -0700 |
| Subject | How to read a make file in python and access its elements |
| Message-ID | <beec5587-f154-47ed-b5f9-d548428d4da5@googlegroups.com> |
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.
[toc] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2013-07-23 09:14 +1000 |
| Message-ID | <mailman.4989.1374534863.3114.python-list@python.org> |
| In reply to | #51056 |
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
[toc] | [prev] | [next] | [standalone]
| From | Dave Angel <davea@davea.name> |
|---|---|
| Date | 2013-07-22 20:39 -0400 |
| Message-ID | <mailman.4991.1374539989.3114.python-list@python.org> |
| In reply to | #51056 |
On 07/22/2013 03:09 PM, 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. > First, just what do you mean by "make file"? You refer to cmake, make, and .mk in three places in your message. How about a link to the actual tool you're interested in? And a brief list of the other tools you're using it with. Is this it? http://www.cmake.org/ Once we're talking about the same tool, then the question is what "elements" are you interested in? If your cmake is anything like the traditional make program, the format is deceptively simple, and enormously complex in usage. But I suspect that your cmake has very little to do with Unix make tools. The cmake that I gave the link for uses a CMakeLists file, which looks nothing like a makefile. -- DaveA
[toc] | [prev] | [next] | [standalone]
| From | alex23 <wuwei23@gmail.com> |
|---|---|
| Date | 2013-07-23 10:48 +1000 |
| Message-ID | <kskjhc$7c2$1@dont-email.me> |
| In reply to | #51056 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web