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

Re: /usr/bin/python in Python 2 and 3



On 21 April 2015 at 08:15, Barry Warsaw <barry@debian.org> wrote:
>For third parties who want to distribute scripts that run out-of-the-box
>everywhere (installers, cross-platform system management or monitoring
>scripts, build scripts, etc.), Python 3 isn't an option. If we remove Python
>2 from the default install in Debian, Python 2 ceases to be an option too. So
>they'll start using sh or perl or something, or ship compiled code, both of
>which I think are net negative options.

Do you think that will happen even if Python 2 is just an apt-get away?

Yes. If I'm distributing a script, I don't want to have to tell users "if you're on Debian newer than X or Ubuntu newer than Y, apt-get install python first. If you're on Fedora newer than Z...".

If I couldn't rely on either 'python' or 'python3' being present, I might try to ship Python scripts with a shell wrapper that does something like this pseudocode:

if (which python3):
    python3 my_real_script.py
else:
    python my_real_script.py

But that's ugly, and I'd be thinking things like: will the syntax I use work in plain sh, or only in bash? do all distros have bash? how similar are the shells 'sh' points to in different distros? I'm sure I could work it out, but if I need to wrap Python scripts in another language, it's a disincentive to use Python for this kind of thing.

Thomas

Reply to: