473,794 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parsing a makefile using Python

I'm interested in parsing a (simple) Makefile using Python. I need to
write a packager for a program I'm supporting, and would like to read
the list of files in the makefile so that I only have to update that
list once.

That is, I have a statement (actually multiple statements) in the
Makefile that looks like:

FILES = a.f b.f c.c d.py e.c \
f.f g.f h.c

and would like a standard way of parsing this. Being able to include
references to other definitions in the makefile, such as

FILES2 = $(FILES) i.f

would be nice as well.

I found an old reference to a post on this topic:
http://groups.google.com/group/comp....f9fc21e3bf32c2
that suggested the distutils could do this, but I haven't found
anything in the documentation for the distutils.
Any suggestions?

Thanks in advance,

Rick

Jul 18 '05 #1
0 2309

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4145
by: Nathaniel Mallet | last post by:
I'm trying to install MySQLdb on SuSE 8.1, but the setup script complains that it can't find /usr/lib/python2.2/config/makefile. I just looked at the ActiveState distribution on Windows, the default Python install on SuSE 8.1 AND the Python 2.3 source distribution downloadable from Python.org, and none of them have any mention of that makefile. The whole config directory simply doesn't exist. The MySQLdb setup script doesn't refer to...
4
11780
by: Bryan Olson | last post by:
Here's the problem: Suppose we use: import socket f = some_socket.makefile() Then: f.read() is efficient, but verbose, and incorrect (or at least does not play will with others);
1
4656
by: Jamie Saker | last post by:
I think I'm overlooking something assumed in socket's makefile method. Googling several hours and digging thru the python reference didn't help - I think I'm overlooking an assumption between Python and UNIX socket objects neither is explicitely discussing. I think my mknod In the makefile operation on socket (pydoc socket.socket.makefile... using AF_UNIX, allowing you to create a file object to correspond to a socket) I've got an sample...
4
4476
by: Efrat Regev | last post by:
Hello, I'd like to ask a question concerning a python script in a makefile. Suppose I have a C++ project (sorry for raising this in a Python newsgroup), with some makefile for it. Before compiling the code, I'd like to check that there are no C++ convention violations (e.g., identifiers beginning with an underscore). So my makefile looks something like this: target: ... verify.py
3
1933
by: Faith | last post by:
any good tips on reading makefiles that were written using C++ ASAP please
5
9906
by: pinkfloydhomer | last post by:
I have a Makefile target that uses a python script, like: %.abc: %.def python myscript.py The problem is that myscript.py and some modules that myscript.py imports are not in the current directory, but in another place in the filesystem, say, /path/to/stuff. If this was a tcsh script, I would just do:
26
3308
by: Ramon F Herrera | last post by:
http://groups.google.com/group/comp.lang.c/browse_frm/thread/86a3ddf0724d9630/4e38340aa824bee0?lnk=gst&q=how+to+best+parse+a+CSV&rnum=1#4e38340aa824bee0 http://tinyurl.com/29q4kf Michael & Paul (or anyone who can help): I have been looking for a solid implementation of CSV parsing and found the thread above, which includes pointers to programs written by both of you. In my first attempt at building them, I failed miserably, and I
6
3677
by: ahlongxp | last post by:
socket.makefile() may lose data when "connection reset by peer". and socket.recv() will never lose the data. change the "1" to "0" in the client code to see the difference. confirmed on both windows and linux. so I guess there is a problem with makefile(). # Echo server program
3
14016
by: gaurav kashyap | last post by:
Hi all, I am using Link-41b parser in my program. The windows version of it has an .exe file that can be executed using os.system command On Linux version,I have a makefile. so my question is: How to run the makefile using some python function. Thanks
0
9671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10433
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10161
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9035
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6777
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4112
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.