Stow and Python

jason petrone jp at NOSPAMdemonseed.net
Tue Oct 1 21:09:23 EDT 2002


Rev. Joe Doyle <doyle at nebcorp.com> wrote:
>        Hello, I'm trying to build a Python package for a large 
> installation, where packages are of the following form:

> 1) /usr/local is a symlink to /tools/foo

> 2) packages live in /tools/bar/package-name

> 3) within each package, there are "bin", "lib", etc. that get linked into 
> /usr/local/ (using GNU stow).

>        My problem is that the Python interpreter looks in the absolute 
> real path for modules, rather than the symlinked "proper" path 
> ("/usr/local/lib" etc.).  How do I get it to look in the right place?  
> Thanks in advance for any hints.

What?!?!  You disgrace your alma mater by forsaking encap.

I always deal with this problem by installing like this:

  ./configure --prefix=/usr/local/
  make install prefix=/usr/local/encap/python-2.3
  epkg python
  rm -rf /usr/local/lib/python2.3/site-packages
  mv /usr/local/encap/python-2.3/lib/python2.3/site-packages /usr/local/lib/python2.3/

That will put everything in the symlinked location except site-packages.

If you just want to add some extra location to the default module path, you
can also add os.path.append('/tools/bar/') to site.py in the python lib
directory. 

I personally just use the PYTHONPATH shell env variable...

jason petrone
UIUC-ACM '00



More information about the Python-list mailing list