[Distutils] win32 default installation

Greg Ward gward@python.net
Sat Sep 9 21:13:02 2000

On 09 September 2000, Thomas Heller said:
> One problem with this is the following (for modules/packages,
> not only for .pyd extensions):
> distutils (on windows), as supplied in python 1.6 and 2.0,
> is installed in <prefix>\lib.
> If I download a new distutils distribution and run 'setup.py install'
> it will install the new version in <prefix>.

Same problem on Unix, and same problem for any modules in the standard
library that also have a "life of their own" -- distutils, asyncore, who
knows what else.

I wanted to sneak in a feature that would let you upgrade bits of the
standard library, but Guido wouldn't let me.  ;-(  My recollection of our
BDFL's reasoning: the Python 1.6 (or 1.5, or 2.0, or whatever) standard
library IS the Python 1.6 (or 1.5, or 2.0, or whatever) standard
library, and I'm not supposed to muck with that.  Period.

Perl's MakeMaker supports this with the "install_dirs=perl" option
(default is "install_dirs=site").  I think this is because most of the
Perl standard library grew out of popular and important CPAN modules
that all have lives of their own.  This phenomenon seems to be less
widespread in Python-land.

Note that the Distutils README.txt does address the issue:


The Distutils have been included with Python since 1.6a1, and Distutils
0.9.2 is the same as the code included with Python 2.0b1 (modulo bug
fixes).  Thus, there's generally no need to install the Distutils under
Python 1.6/2.0.  However, Distutils releases may occasionally get ahead
of Python releases, so if you really like life on the bleeding edge, you
might want to install this Distutils release into your Python 1.6/2.0

To do this, you'll need to hide the original Distutils package directory
from Python, so it will find the version you install.  For example,
under a typical Unix installation, the "stock" Distutils directory is
/usr/local/lib/python1.6/distutils; you could hide this from Python as

    cd /usr/local/lib/python1.6        # or 2.0
    mv distutils distutils-orig

On Windows, the stock Distutils installation is "Lib\distutils" under
the Python directory ("C:\Python" by default with Python 1.6a2 and
later).  Again, you should just rename this directory, eg. to
"distutils-orig", so that Python won't find it.

Once you have renamed the stock Distutils directory, you can install the
Distutils as described above.

Correct?  Sure.  Satisfactory?  Not really...

> What should we do here? Try to import the old package/module,
> and use their __path__ as the destination directory?

As I implied above, my preferred solution would be an option in the
setup script, eg. "install_dirs = 'standard'" (default 'site'), so that
certain module distributions could declare themselves as being part of
the standard library.  But that was shot down, and I think your idea is
even more likely to be Frowned Upon.  (Strikes me as a bit too sneaky
and subtle.)

Greg Ward                                      gward@python.net