Bite of the Buildbugs!
rlaager at wiktel.com
Tue Dec 12 21:31:58 UTC 2017
On 12/11/2017 07:45 PM, Gary E. Miller via devel wrote:> Binary distro
installs, unexpectedly to some, go into a temporary> location
Not that it matters much, but just for clarification... For Debian, the
temp location is ./debian/tmp (where . is the source tree). For RedHat,
it often was /usr/src back in the day; otherwise maybe ~/.rpmbuild. It's
been quite a while since I've done RPM packaging.
> I missed a lot of the PYTHONPATH, sys.path and .pth
> discussion. Can someone(s) post quick compare and contrast of these
> three ways to proceed?
sys.path is the path that is actually searched. sys.path is built from a
set of installation-dependent defaults, plus the value of the PYTHONPATH
environment variable. That is, PYTHONPATH is *added* to the default
sys.path. Contrast this with PATH, where the environment variable *is*
the list to be searched.
For example, try these on your system:
$ python -c 'import sys; print sys.path'
$ PYTHONPATH=/opt/foo/site-packages \
python -c 'import sys; print sys.path'
You will see that PYTHONPATH *adds* to sys.path. Paths in PYTHONPATH are
added high in the list (second, after '' which is the current
directory), so paths in PYTHONPATH are searched before the
.pth files are another way to *add* to sys.path.
If your Python is missing /usr/local/.../site-packages option(s), you
have two ways to add them: PYTHONPATH or a .pth file (in
/usr/lib/pythonX.Y). I believe that a .pth file is generally preferable
to setting PYTHONPATH, as it is often challenging to ensure that
environment variables are set/inherited everywhere you need. For
example, cron, systemd units, and sudo tend to have separate environments.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 455 bytes
Desc: OpenPGP digital signature
More information about the devel