From: Federico Beffa <beffa@ieee.org>
To: rekado@elephly.net
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: Python ignores pth files?
Date: Mon, 2 Mar 2015 09:18:42 +0100 [thread overview]
Message-ID: <CAKrPhPP2S1H8gu-i8sYUMVWsSWaka6eZbeUPgPhtaxOWxrRZsw@mail.gmail.com> (raw)
Ricardo Wurmus <rekado@elephly.net> writes:
> Ricardo Wurmus writes:
>
>> Taylan Ulrich Bayırlı/Kammer writes:
>>
>>> Ricardo Wurmus <rekado@elephly.net> writes:
>>>
>>>> pygtk and pygobject both come with .pth files that instruct Python to
>>>> check out the "gtk-2.0" subdirectory, yet these files are seemingly
>>>> ignored as (according to strace) Python makes no attempt to look inside
>>>> the declared subdirectories when Solfege starts up.
>>>
>>> I had the same experience trying to package nmap (still lying around in
>>> a branch). The #python IRC channel on Freenode told me that indeed .pth
>>> files in PYTHONPATH aren't used, only those in some system paths. I
>>> can't remember the details, but Python's documentation should tell.
>>
>> Apparently, it is possible to add the paths declared by pth files by
>> explicitly adding the parent site-packages directory as a site dir:
>>
> [...]
>>
>> Note that site.addsitedir added the subdirectory as declared by
>> "pygtk.pth". I wonder if this means that I'll have to patch the
>> executable to run site.addsitedir over all elements in PYTHONPATH until
>> sys.path no longer changes.
>
> I'm now patching the sources to add all site-packages directories, which
> causes their pth files to be interpreted:
>
> (substitute* "run-solfege.py"
> (("import os")
> "import os, site
> for path in [path for path in sys.path if 'site-packages' in path]: site.addsitedir(path)"))
>
As you have found out, the .pth files are not handled by python
natively. Instead, they are part of setuptools/easy_install. See
https://lists.gnu.org/archive/html/guix-devel/2014-12/msg00306.html
and
http://pythonhosted.org//setuptools/easy_install.html#reference-manual
Regards,
Fede
next reply other threads:[~2015-03-02 8:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-02 8:18 Federico Beffa [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-03-01 20:27 Python ignores pth files? Ricardo Wurmus
2015-03-01 20:34 ` Taylan Ulrich Bayırlı/Kammer
2015-03-01 20:58 ` Ricardo Wurmus
2015-03-01 22:14 ` Ricardo Wurmus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKrPhPP2S1H8gu-i8sYUMVWsSWaka6eZbeUPgPhtaxOWxrRZsw@mail.gmail.com \
--to=beffa@ieee.org \
--cc=guix-devel@gnu.org \
--cc=rekado@elephly.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.