[Python-ideas] py launcher for Linux?

Eric V. Smith eric at trueblade.com
Wed Apr 16 15:08:43 CEST 2014


On 04/16/2014 07:50 AM, Nick Coghlan wrote:
> 
> On 16 Apr 2014 06:27, "Eric V. Smith" <eric at trueblade.com
> <mailto: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.

Okay. I'll take a crack at this.

Eric.




More information about the Python-ideas mailing list