Re: writing publicly distributed codes in python

Guido.van.Rossum@cwi.nl
Mon, 26 Sep 1994 09:30:56 +0100

> Python looks like an interesting language, but: I'm trying to write some code
> that I can distribute publicly, and I'm wondering if python
> is too esoteric for this? In particular, how does one
> handle the problem that most cites probably don't have python
> installed?

This must become a FAQ -- you're the second person this morning who asks!

There's a little-known demo script that helps you creating binaries
from Python scripts. It's Demo/scripts/freeze.py (I presume you
*have* got Python :-). It's not perfect, because on each and every
system the set of librarie you have to link with is different, so
it'll probably require some twiddling. The basic technology is fairly
simple: find the set of modules needed by the script (this is done
with a simple scan for import statements, and applied recursively),
then compile each module and create a C file that contains an
initializer from which the compiled code can be reconstructed. This
is then compiled and linked with the rest of the interpreter, and
voila -- a self-contained Python program.

If you don't get it working, a colleague of mine <Jack.Jansen@cwi.nl>
has written an improved version...

--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>