jonka750 at student.liu.se
Sat Dec 8 10:17:21 NZDT 2007
On Wed, 28 Nov 2007 22:06:04 +0100, Carlo Calica <carlo at calica.com> wrote:
> 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
> 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.
I have a new proposal. Instead of replacing sys.prefix we can append
some site-dirs. I have attached a patch which looks for 'Programs/Python'
in the path and if found does some magic to append
/S/L/L/python<ver>/site-packages and /S/L/L/site-python to the site-dirs.
This removes the need to define the 'import ...' in gobolinux.pth.
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1014 bytes
Desc: not available
Url : http://lists.gobolinux.org/pipermail/gobolinux-users/attachments/20071207/da47ec40/attachment.diff
More information about the gobolinux-users