Re: setuptools: add .pth file to site-packages automatically

PJ Eby <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]> Sat, 11 Jan 2014 17:20:08 -0500
Newsgroups gmane.comp.python.peak
Message-ID <CALeMXf5d1D3-YQoqSncSmdasggc27_=N+n6WKx4kRB2Pf3W5Xw@mail.gmail.com>
On Wed, Jan 8, 2014 at 5:22 AM, Maxim Yaskevich
<[email protected]> wrote:
> Hi.
>
> I'm wondering about how a user could add package's .pth file into system
> `site-packages` directory without having write access to it.
>
> Setuptools documentation says there is a workaroung for this problem, but I
> don't really get it.
>
> Is it possible to have the foobar.pth file copied to site-packages dir
> automatically with python setup.py install command?
>
> src/
>   foobar/...
>   foobar.pth
>   setup.py
>

No.  Setuptools generates and installs various .pth files in order to
support namespace packages and to put eggs on sys.path, but it does
not support package-supplied .pth files, and you should probably not
be using them anyway.  Most use cases for .pth files are properly
handled by laying out your package correctly in the first place, or by
using namespace packages.  All other uses of .pth files are pretty
much either esoteric, deprecated, or both.  ;-)