[Distutils] Trouble installing Myghty with --prefix

skip@pobox.com skip at pobox.com
Wed Nov 30 19:21:20 CET 2005


    Phillip> Skip, if you want to use a custom install location using
    Phillip> PYTHONPATH, you need to read this section:

    Phillip> http://peak.telecommunity.com/DevCenter/EasyInstall#traditional-pythonpath-based-installation

Folks,

Please note a couple things:

    1. I use pth files, not PYTHONPATH.  They are much easier to control
       than insuring the every user of the system (even the daemon-ish ones)
       have PYTHONPATH set properly.  I have one pth file in the system
       install.  That's the full extent of the pollution of that directory
       tree.  I want to keep it that way.  ISTM that setuptools should be
       able to easily deduce what the default sys.path is, since Python does
       the heavy lifting of parsing/executing pth files for you:

           python -c 'import sys ; print ":".join(sys.path)'

       Voila!  Now setuptools should know that /usr/local/mojam/lib/
       python2.3/site-packages *is* in sys.path and that I'm not trying to
       install packages for some sort of offbeat Python installation.

    2. I didn't use setuptools directly.  In fact, when I executed

          python setup.py install --prefix=/usr/local/mojam

       in the Myghty 0.99a source directory I had no idea setuptools would
       be used at all.  Mike Bayer (Myghty's author) tells me that was a
       requirement because Myghty depends on something called Paste.  The
       whole notion of using setuptools is highly indirect for me.

    Phillip> Your configuration, however, would be something like:

    Phillip>      [install]
    Phillip>      prefix = /usr/local/mojam

    Phillip>      [easy_install]
    Phillip>      site_dirs = /usr/local/mojam/lib/python2.4/site-packages

    Phillip> instead of the configurations shown there.

I'll take a look.  At first blush I'm a bit put off by the notion it seems
to promote that somehow using .pth files is wrong.  I think you should be
able to deal with them straight out of the box, no tricks required,
especially considering they are blessed as part of the default site.py, and
not likely to go away soon.

    Phillip> Right; the other option is to use this approach:

    Phillip> http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python

    Phillip> There's a 'virtual-python' script linked there that will set it
    Phillip> up for you; you would run:

    Phillip>      virtual-python.py --prefix=/usr/local/mojam

    Phillip> to set it up.  This should not delete any existing files there,
    Phillip> just add symlinks and create a /usr/local/mojam/bin/python
    Phillip> executable that will think its sys.prefix is /usr/local/mojam.
    Phillip> (It will overwrite /usr/local/mojam/bin/python, though, if it
    Phillip> already exists.)

That's definitely not what I want.  I want to "/usr/bin/env python" to
resolve to /usr/bin/python in all cases (like when a CGI script executes as
nobody or when procmail runs spambayes) but use a single pth file to tell it
where my local stuff lives.  Such tools are almost certainly never going to
have /usr/local/mojam/bin in their PATH.

Skip


More information about the Distutils-SIG mailing list