Putting site-packages somewhere else

Lars Kellogg-Stedman lars at larsshack.org
Sun Oct 28 16:46:46 EST 2001


I'm a long-time perl user who's recently started working more with Python.
I'm also responsible for software packaging and distribution at my
employer, and I'm looking for some suggestions in maintaining our Python
distribution.

We're using an Encap-based software distribution system, which means that
each software package is installed into its own subdirectory, e.g.,
'/usr/local/encap/python-2.1.1', and then symlinks are created so that it
appears in /usr/local.

The problem is that additional modules -- e.g., modules that end up in
site-packages -- should *not* get installed into the package directory.
They should be placed in, e.g., /usr/local/lib/python2.1/site-packages,
rather than /usr/local/encap/python-2.1.1/lib/python2.1/site-packages,
which is where they're going right now.

After spending some time looking through the Python documentation and
perusing some mailing list archives, I haven't found a good way of doing
this.  The solution needs to fulfill the following requirements:

  (1) Distutils needs to know about the proper location for packages,
      so that no additional flags need be specified on the command line.

  (2) The interpreter needs to know about the site-packages directory
      *outside* of the python installation prefix.

I thought that perhaps I could modify site.py to add the additional
path(s), but after reading through the comments in that file, I'm not
exactly sure how I would go about making those changes.  I'm sure this is a
common problem with a simple solution; I'd appreciate it if someone could
point me at it.

Thanks!

-- Lars

-- 
Lars Kellogg-Stedman <lars at larsshack.org>




More information about the Python-list mailing list