How to Convert a makefile to Python Script

R

rkoida

Hello All
I am working on a Problem to convert makefile in to a python script.
Are there any Modules? Please try to comment.

Thanks
rkoida
 
B

Bengt Richter

Hello All
I am working on a Problem to convert makefile in to a python script.
Are there any Modules? Please try to comment.

Thanks
rkoida
IIUC, the scons project came to be to implement make functionality in python,
so I'd try to find someone there to ask. They must have thought about it a lot.

http://www.scons.org/

Regards,
Bengt Richter
 
N

Nick Vargish

I am working on a Problem to convert makefile in to a python script.
Are there any Modules? Please try to comment.

How about this (untested):

-------- cut here --------
import subprocess

print ("import os")
make = subprocess.Popen(["make", "-n"],stdout=subprocess.PIPE)
makeout = make.communicate()[0]
for l in makeout.split('\n'):
print 'os.system("%s")' % l.replace('"', '\"')
-------- cut here --------

The quote escaping replace() might not be quite right, but you get
what I'm suggesting, right? To mangle a lwall quote, "The only
substitute for make is make."

Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top