[Distutils] Some code to play with

Greg Ward gward@cnri.reston.va.us
Mon, 22 Mar 1999 10:10:22 -0500

Hi all --

as promised, I have finally checked in some real Distutils code.
There's just enough functionality for the Distutils to build and install
itself.  To try it out, you'll need to download the code from the
anonymous CVS archive at cvs.python.org; see


for instructions.

If you just want to try it out, then from the top-level Distutils
directory (the one that has setup.py), run:

    ./setup.py build install

This will copy all the .py files to a mockup installation tree in
'build', compile them (to .pyc -- don't run setup.py with "python -O",
as I don't handle that yet and it will get confused), and then copy the
whole mockup tree to the 'site-packages' directory under your Python
library directory.  Figuring the installation directory relies on Fred
Drake's 'sysconfig' module -- I don't recall what the status of
sysconfig was on non-Unix systems; hope someone out there can try it and
let us know!  Come to think of it, I'd like to hear how it works on
*any* system apart from my Red Hat Linux 5.2, stock Python 1.5.1, home
PC.  ;-)

If you want to build in a different directory, use the '--basedir'
option to the 'build' command; to install in a different place, you can
use either the '--prefix' or '--install-lib' options to the 'install'
command.  Here are a couple of samples to demonstrate:

    ./setup.py build --basedir=/tmp/build install --prefix=/tmp/usr/local
    ./setup.py build --basedir=/tmp/build
    ./setup.py install --build-base=/tmp/build --prefix=/tmp/usr/local

Go crazy.  No documentation yet -- please read the code!  Start with
distutils/core.py which, as its name implies, is the start of
everything.  I went nuts with docstrings in that module last night, so
hopefully there's just enough there that you can figure things out in
the absence of the "Distutils Implementation Notes" document that I'd
like to write.

Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913