[Python-ideas] py launcher for Linux?

Nick Coghlan ncoghlan at gmail.com
Wed Apr 16 13:50:17 CEST 2014


On 16 Apr 2014 06:27, "Eric V. Smith" <eric at trueblade.com> wrote:
>
> On 04/15/2014 10:12 PM, Nick Coghlan wrote:
> > Something that came up during PyCon was the idea of a "py" script that
> > brought "Python Launcher for Windows" explicit version dispatch to
Linux.
> >
> > Anyone care to try their hand at writing such a script?
>
> I meant to bring this up at the PyCon sprints. On Windows, the launcher
> finds the various versions of Python by looking in the registry. How is
> a Linux version supposed to find what versions of Python are installed?
>
> I have a pristine 2.7 in /usr/local/bin and the system python 2.7 in
> /usr/bin. I've also seen /opt/bin used, and other places deliberately
> not on PATH. How would a launcher find these, let alone decide which one
> to use?

Note that my main interest here is in making commands like:

    py -3 -m pip install foo

cross platform rather than Windows specific. At the moment we don't have a
way to explicitly invoke Python 3 that works everywhere.

Given the way POSIX installations of Python name things, simple string
munging, along with delegation to the shell's normal shebang line
processing when given a script without nominating a particular version to
use, should suffice to largely reproduce the PEP 397 behaviour.

The launcher config file also provides an opportunity to make the "default
Python" a per user setting without altering which version the "python"
symlink refers to.

Cheers,
Nick.

>
> I'll be around the sprints for a very short time this morning, if anyone
> wants to discuss it.
>
> Eric.
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140416/624ce1b9/attachment.html>


More information about the Python-ideas mailing list