[gobolinux-users] $pythonpath
Carlo Calica
carlo at calica.com
Thu Nov 29 10:06:04 NZDT 2007
On 11/28/07, Jonas Karlsson <jonka750 at student.liu.se> wrote:
>
> I've looked at the code in site.py and it has a 'if sitepath
> in known_paths :' check, but only for appending the sitepath
> to path. It still tries to process *.pth files in sitepath,
> leading to the recursion. By indenting the following block,
> handling the *.pth files this does not happen and the
> addition to gobolinux.pth works. I've attached a diff with
> the change. However this change changes the behaviour so
> known paths can't be added as sitedirs, as it will be a
> known path. Adding the 'import...' before the paths or just
> not declaring the path beside the addsitedir(foo) works
> around this issue. Maybe there's a better solution?
>
I'd like to step back and redefine the problem:
Python does NOT read .pth files located in
/S/L/L/python-2.5/site-packages. Specifically, it reads gobolinux.pth
in /P/Python/Current/lib/python-2.5/site-packages. gobolinux.pth adds
/S/L/L/python-2.5/site-packages to sys.path (might be wrong my python
is weak) but then doesn't read any additional .pth files. Basically
reading .pth files doesn't recurse through a read .pth.
Does that describe this bug? Sorry I'm being explicit, I've been gone
for awhile and don't want to waste time because I'm rusty. Assuming
yes.
First we should find out if non-recursing .pth is a bug or a design
choice. The Python devs might have a very good reason to avoid it
(similar to modutils not following symlinks)
If recursing is ok, Jonas patch may be a solution but it'll need a lot
of testing.
If recursing is not ok, we need to get python looking in /S/L/L
instead of /P/Python directly. I'd like to point at "def
addsitepackages" in site.py. Replacing "prefixes = [sys.prefix]" with
"prefixes = ['/usr']" might have the desired effect . This is
probably a less drastic change. Compiling python under rootless would
be iffy.
Anyone have a good test case for this? HAL used to have
hal-device-manager which used pygtk which tickled this bug but its not
there anymore.
Thanks.
--
Carlo J. Calica
More information about the gobolinux-users
mailing list