By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,526 Members | 1,618 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,526 IT Pros & Developers. It's quick & easy.

How to Convert a makefile to Python Script

P: n/a
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

Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 19 Apr 2005 20:49:31 -0700, rk****@yahoo.com wrote:
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
Jul 19 '05 #2

P: n/a
Thanks For Your Help

Regards
rkoida

Jul 19 '05 #3

P: n/a
rk****@yahoo.com writes:
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

--
# sigmask (lambda deprecation version) 20041028 || feed this to a python
print ''.join([chr(ord(x)-1) for x in 'Ojdl!Wbshjti!=ojdlAwbshjti/psh?'])
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.