gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] [PATCH] Build: add the configuration v ariable python_lib


From: Beat Bolli
Subject: Re: [gpsd-dev] [PATCH] Build: add the configuration v ariable python_libdir.
Date: Thu, 05 Dec 2013 08:26:45 +0100
User-agent: Roundcube Webmail/0.7.2

Hi Greg

On 2013-12-04 23:44, Greg Troxel wrote:
Beat Bolli <address@hidden> writes:

The help for get_python_lib() says:

Help on function get_python_lib in module distutils.sysconfig:

get_python_lib(plat_specific=0, standard_lib=0, prefix=None)
    Return the directory containing the Python library (standard or
    site additions).

    If 'plat_specific' is true, return the directory containing
platform-specific modules, i.e. any module from a non-pure-Python module distribution; otherwise, return the platform-shared library
    directory.  If 'standard_lib' is true, return the directory
containing standard Python library modules; otherwise, return the
    directory for site-specific modules.

Hmm, I'm having a hard time following that documenation.

plat_specific would seem to be about having a directory for python
modules that are specific to this cpu architecture vs modules that are
just in python and therefore arch-independent.  This seems to be the
same notion as /usr/lib vs /usr/share. But looking on my system, I see

  /usr/pkg/lib/python2.7/plat-netbsd6

so that makes me think that the sharing is about OS rather than cpu.
But the file

  /usr/pkg/lib/python2.7/site-packages/gps/packet.so

is compiled for not only NetBSD 6 but i386. So this whole plat_specific
notion seems boggling.


/usr/pkg/lib/python2.7/site-packages  # standard_lib false
/usr/pkg/lib/python2.7/               # standard_lib true

    If 'prefix' is supplied, use it instead of sys.prefix or
    sys.exec_prefix -- i.e., ignore 'plat_specific'.

Passing prefix='/usr/local' yields the correct path under Linux, but
ignores the plat_specific argument. Would this hurt on other platforms?

I cannot understand how the before and after "ie"" parts are the same.
It seems to blur changing prefix and also whether or not to use the
plat-$uname subdir.

Yeah, for sure the arguments are not orthogonal.

When you say passing /usr/local and  "correct path", do you mean

  ${gpsd_prefix}/lib/python2.7/site-packages

instead of

  ${python_prefix}/lib/python2.7/site-packages

?

Yes, exactly.

The conclusion I've more or less come to over the years is that
building python in one prefix and a package in another is trouble, and
there are two ways to cope:

Teach python about the other prefix, and have it look there, or use
   PYTHONPATH.  .  Have packages put python libs in their own prefix,
   but parallel structure to how it would be in python's prefix.

Install the python bits in python's prefix instead of the package's prefix. This is odd because it writes outside of ${prefix}, but then
   python finds the bits.

Neither way is really satisfactory. But they end up being the same with matching prefixes, which is the case I really care about. I prefer to have python bits in gpsd's prefix by default, which is what your patch
does.  So it looks good to me.

The ugly side of the patch is that it's not automatic, so I'm leaning more towards my second idea from 22:20. We could pass both plat_specific and prefix parameters, in case the prefix and platform-ness get untangled some day.

As a side note, on both Linux and OS X (BSD?), the output of get_python_lib() is the same regardless of the value of plat_specific. On Ubuntu, .so files are found in /usr/lib/python2.7/lib-dynload and /usr/lib/python2.7/dist-packages. lib-linux2 contains converted C headers from /usr/include.

Beat
--
mail: echo '<address@hidden>' | tr -d '[A-S]'
pgp: 0x506A903A; 49D5 794A EA77 F907 764F  D89E 304B 93CF 506A 903A
gsm: 4.7.7.6.0.7.7.9.7.1.4.e164.arpa
icbm: 47.0452 N, 7.2715 E
http: drbeat.li

"It takes love over gold, and mind over matter" -- Dire Straits



reply via email to

[Prev in Thread] Current Thread [Next in Thread]