From: Ricardo Wurmus <rekado@elephly.net>
To: "Taylan Ulrich Bayırlı/Kammer" <taylanbayirli@gmail.com>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: Python ignores pth files?
Date: Sun, 01 Mar 2015 23:14:08 +0100 [thread overview]
Message-ID: <877fv09xhr.fsf@mango.localdomain> (raw)
In-Reply-To: <878ufga0za.fsf@mango.localdomain>
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)"))
~~ Ricardo
next prev parent reply other threads:[~2015-03-01 22:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-03-02 8:18 Federico Beffa
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=877fv09xhr.fsf@mango.localdomain \
--to=rekado@elephly.net \
--cc=guix-devel@gnu.org \
--cc=taylanbayirli@gmail.com \
/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.