Fix for Python library path problem

Fred Wright fw at fwright.net
Wed Sep 27 23:31:12 UTC 2017


On Wed, 27 Sep 2017, Gary E. Miller via devel wrote:
> Fred Wright via devel <devel at ntpsec.org> wrote:

>   It only matters
> > for Linux, since get_python_lib() returns FHS-compliant results on
> > *BSD, and on OSX the paths are so completely different that FHS
> > doesn't apply.
>
> Uh, lost me.  macOS is very much FHS compliant.

MacPro:~ fw$ /usr/bin/python -c 'from distutils import sysconfig; print(sysconfig.get_python_lib())'
/Library/Python/2.7/site-packages

Completely different scheme.

> When I run NTPsec on macOS I export PYTHONPATH.

Should no longer be necessary, since Eric's patch doesn't affect my fix in
the OSX case.

It does, however, screw up BSD.  E.g., on FreeBSD:

>>> sysconfig.get_python_lib()
'/usr/local/lib/python2.7/site-packages'
>>> sysconfig.get_python_lib().replace('/usr', '/usr/local')
'/usr/local/local/lib/python2.7/site-packages'

It needs a bit more restraint in patching the path.  Maybe it should only
apply to paths where the first element is 'usr' and the second element is
not 'local'.

> And AFAIK, NTPsec is now, once again, installing in the proper location
> on all OS.  I no longer see an issue here.

Well, *I* see an issue until setting PYTHONPATH is rendered unnecessary on
all platforms, which is not yet the case.

Fred Wright


More information about the devel mailing list