[Distutils] Distributing python applications

Tessa Lau tlau@ofb.net
Fri Jul 6 20:42:01 2001

I'm switching from autoconf to the distutils for building and
installing my Python application.  This application includes one
pure-python package, one impure extension package, and various modules
in the root package.

I've figured most of it out except for two things that I used to do
using autoconf:

1) Install two python scripts in a system-wide bin directory (not

2) Create a new .py file by doing textual substitution on a .py.in file

Suppose my program is called blarg.  I want users to be able to run
"blarg" from their command prompt.  The file blarg is a python script
that imports modules from blarg's library directory, which is usually
something like ${exec_prefix}/lib/blarg-X.Y, where X.Y is the blarg
version number.

The reason I used textual substitution is so that I only have to
change the version string in one place, and the same string is
propagated to everyplace that needs it, including the two main
application scripts that are installed in ${prefix}/bin.

How can I do this using distutils?