[Python-Dev] Proposing PEP 376

Tarek Ziadé ziade.tarek at gmail.com
Wed Apr 7 16:01:35 CEST 2010


2010/4/2 P.J. Eby <pje at telecommunity.com>:
[...]
>
> * Paths under the base installation location are relative to the base
> * Paths not under the base installation location, but under the installation
> prefix, are also stored relative to the base, IF the base location is a
> subpath of the installation prefix
> * All other paths are absolute.
>
> Where "base location" is the effective --install-lib directory, and prefix
> is the effective --prefix.  (Which default of course to site-package and
> sys.prefix respectively, but the spec shouldn't be in terms of those
> defaults.)

Just to make sure we agree on this:

we use relative path if the file is in site-packages, or somewhere
under sys.prefix. For the latter this is only if site-packages is
under sys.prefix.

Examples under debian:

    docutils/__init__.py          ->     located in
/usr/local/lib/python2.6/site-packages/
    ../../../bin/rst2html.py       ->  located in /usr/local/bin
    /etc/whatever                  ->     located in /etc

So, everything under /usr/local (sys.prefix) is relative to
/usr/local/lib/python2.6/site-packages.
Other paths are absolute.

In case the site-packages directory was not under sys.prefix, we would
use an absolute path for files under sys.prefix but not in
site-packages. (like rst2html.py)

Regards
Tarek
-- 
Tarek Ziadé | http://ziade.org


More information about the Python-Dev mailing list