views:

201

answers:

2

I've explored python for several years, but now I'm slowly learning how to work with c. Using the python documentation, I learned how to extend my python programs with some c, since this seemed like the logical way to start playing with it. My question now is how to distribute a program like this.

I suppose the heart of my question is how to compile things. I can do this easily on my own machine (gentoo), but a binary distribution like Ubuntu probably doesn't have a compiler available by default. Plus, I have a few friends who are mac users. My instinct says that I can't just compile with my own machine and then run it on another. Anyone know what I can do, or some online resources for learning things like this?

+6  A: 

Please read up on distutils. Specifically, the section on Extension Modules.

Making assumptions about compilers is bad policy; your instinct may not have all the facts. You could do some marketplace survey -- ask what they can handle regarding source distribution of extension modules.

It's relatively easy to create the proper distutils setup.py and see who can run it and who can't.

Built binary distributions are pretty common. Perhaps you can sign up some users will help create binary distributions -- with OS-native installers -- for some considerations.

S.Lott
+1  A: 

S. Lott is right. You should first look at distutils. After you've learned what you need from distutils, look at setuptools. Setuptools is built on top of distutils and makes installation easy for your users. Have you ever used easy_install or Python Eggs? That's what's next.

Troy J. Farrell