gpsd-dev
[Top][All Lists]
Advanced

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

Re: Python version hell


From: Gary E. Miller
Subject: Re: Python version hell
Date: Tue, 28 Apr 2020 10:53:28 -0700

Yo John!

On Tue, 28 Apr 2020 10:01:46 -0400
John Ackermann N8UR <address@hidden> wrote:

> I'm running Ubuntu 19.10 which installs Python 2.7 as the system
> default.  I tend to use Python 3.7 for my projects, using a shebang
> line of "#!/usr/bin/env python3".

Fairly normal.

> When I first tried to build using scons on the cloned repo, it
> complained because it couldn't find the pyserial module, which makes
> sense because I installed that for python3.

So, a valid complaint.

> After RTFM, I ran "scons target_python=python3.7" and that completed
> without errors.

Good.

> HOWEVER, the python programs like gpsrinex and gpsprof still use a
> shebang line of "#!/usr/bin/env python" which executes the default
> python2.7.

Which is the correct behavior.

> That of course fails, because the gps module is built for Python3 per
> the target_python argument.

Fails because you forgot to build for both versions of Python.

> I don't know how the scons system works, but suggest that if a
> target_python is specified, that version should be used in the shebang
> line for the generated programs.

Nope.  gpsd follows the PEP on this one.

Look in SConstruct for @PYSHEBANG@.  Change that to the shebang you want.

> scons created /usr/local/lib/python3 and put the gps module there.
> However, /usr/local/lib/python3.7 was already in existence and as
> noted I had specified the python_target to be python3.7.

gpsd gets the python lib directory from your python.  gpsd is just
doing what python told it to do.

> It seems a tad aggressive for scons to create a new version directory
> in lib/ and particularly to do so with the major number when it's been
> given both major and minor in target_python.

But, as required by python.

> I think that on some Linux distros lib/python<major> is a symlink to
> lib/python<major.minor>.  That doesn't seem to be the case on Ubuntu,
> at least in /usr/local/lib.

gpsd prefers to follow FHS and PEP.

> Finally, guess what: in the newly released Ubuntu 20.04, the default
> is now Python3! :-)

Oh, the horror...

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: pgpy5ompBW69S.pgp
Description: OpenPGP digital signature


reply via email to

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