Install tangle

Richard Laager rlaager at wiktel.com
Sat Jan 13 03:44:32 UTC 2018


On 01/12/2018 03:45 PM, Hal Murray via devel wrote:
> What is the current status?

ntpsec follows upstream waf's behavior. It no longer violates --prefix.

> Does configure bail if installing the python libs in /usr/local/ isn't going 
> to work?

At configure time, waf cannot tell that it *will not* work, only that it
*might not* work.

Here are three ways I might re-write your question:

1) Does configure bail if installing the python libs might not work? No.

2) Does configure print a warning if installing the python libs might
not work? No.

3) Does install print a warning if the python libs might not work? No.

I think #1 always has to be no. Otherwise, you'll break tons of working
setups, including but not limited to package builds.

A warning might be helpful, and a warning doesn't ever break anything
(thought it could scare somebody unnecessarily in a false positive
scenario). The warning could be at configure time, install time, or
both. A warning post-install would have far fewer false positives than
one at configure time. If someone is writing a post-install warning, you
might want to omit it (or soften the language) if --destdir is set.

> Do we have a good writeup for the PYTHONPATH and/or .pth solutions?

Not really. Here's something:

NTPsec installs a Python module named "ntp".  It consists of Python code
installed to PYTHONDIR and a compiled C module installed to
PYTHONARCHDIR. The values of PYTHONDIR and PYTHONARCHDIR are output by
the ./waf configure step, and may be customized by the --pythondir and
--pythonarchdir arguments to the same. The two are often the same directory.

The default --prefix is /usr/local. Some distros include a /usr/local
site-packages directory in Python's search path (sys.path) while others
do not. If your distro does not, anything using the "ntp" module,
including the NTPsec utilities, will fail if you install using
--prefix=/usr/local.

While the failure *may* happen with --prefix=/usr/local, it definitely
*will* happen if you use a non-standard --prefix.

In either case, you can fix it by simply adding your particular
PYTHONDIR (and PYTHONARCHDIR if different) to sys.path using *either* of
the following ways:

A) Create a .pth file:

1. Determine the directory:
   $ python -c 'import sys ; print(sys.path)[1]'
   For example:
   /usr/lib/python2.7

2. Create the file, named SOMETHING.pth, with the contents being the
directories to add:
   # echo /usr/local/lib/python2.7/site-packages \
       > /usr/lib/python2.7/local.path

If PYTHONARCHDIR is different, add another line to the same file with
that path.

OR

B) Set the environment variable PYTHONPATH:

For example:

echo export PYTHONPATH=/usr/local/lib/python2.7/site-packages \
  >> ~/.bashrc

If PYTHONARCHDIR is different, set them both, separated by a colon, just
like the system $PATH uses.

Option A has the advantage of seamlessly working system-wide where
option B generally requires extra work for things like cron and systemd.
On the other hand, option B has the advantage of being per-user and does
not require root permissions like option A.

-- 
Richard


More information about the devel mailing list