Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #9726

Re: MBF for deprecating Python2 usage

From Geoffrey Thomas <geofft@ldpreload.com>
Newsgroups linux.debian.maint.python
Subject Re: MBF for deprecating Python2 usage
Date 2017-08-08 00:50 +0200
Message-ID <ubZ0u-6St-17@gated-at.bofh.it> (permalink)
References <uawjU-5YP-3@gated-at.bofh.it> <uaBtf-1rM-9@gated-at.bofh.it> <uaLCi-867-15@gated-at.bofh.it> <uaS13-3Oj-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 4 Aug 2017, Scott Kitterman wrote:

> If the primary concern is what happens when a user types "python", then can we
> address that in command-not-found and leave /usr/bin/python out of it?

Debian doesn't ship command-not-found by default. One other approach here 
would be to have /usr/bin/python exec python3 if it's run interactively -- 
that is, if isatty(0) -- and print an error message and exit otherwise. 
I don't think it is too bad to print an error message instead of failing 
the exec, since that's equivalent to what happens if you're missing a 
shared library or something: the exec succeeds, but the dynamic loader 
prints an error and exits nonzero.

Ship this /usr/bin/python with python3-minimal, and have the 
python-minimal package divert it and replace it with the current 
/usr/bin/python (a symlink to python2.7). This way we can build systems 
with Python 3 only that behave reasonably, but also allow doing `apt-get 
install python` to cause /usr/bin/python to start working again.


However, I feel like another reason to care about /usr/bin/python is so 
that sysadmins responsible for multiple platforms can continue writing 
#!/usr/bin/python (or #!/usr/bin/env python) scripts and use the same 
script on all their machines. If I can't do this and need 
platform-specific scripts, I might as well use some other language or ship 
compiled binaries. Keeping Python viable for this use case is a large part 
of why I originally proposed pythonmux: I can write scripts that declare 
that they're polyglot Python 2/3 and work on both Python 2-only and Python 
3-only systems, but a Python 2 script using #!/usr/bin/python will give me 
an error (as it should!) if there's no Python 2 installed on the machine.

Last time I checked (2015), entirely reasonable versions of RHEL and macOS 
both shipped only Python 2 and not Python 3. Is it likely to be the case 
that all UNIXy OSes within security support in 2019 or 2020 will have a 
/usr/bin/python3 (preferably 3.3+)? If so, that's a viable option. I just 
want my best migration path from #!/usr/bin/python to not involve 
rewriting my scripts in Go.

-- 
Geoffrey Thomas
https://ldpreload.com
geofft@ldpreload.com

Back to linux.debian.maint.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

MBF for deprecating Python2 usage Matthias Klose <doko@debian.org> - 2017-08-04 00:00 +0200
  Re: MBF for deprecating Python2 usage barry@debian.org - 2017-08-04 03:10 +0200
    Re: MBF for deprecating Python2 usage Scott Kitterman <debian@kitterman.com> - 2017-08-04 05:30 +0200
      Re: MBF for deprecating Python2 usage Piotr Ożarowski <piotr@debian.org> - 2017-08-04 08:10 +0200
      Re: MBF for deprecating Python2 usage barry@debian.org - 2017-08-04 16:20 +0200
        Re: MBF for deprecating Python2 usage Ole Streicher <olebole@debian.org> - 2017-08-04 17:10 +0200
          Re: MBF for deprecating Python2 usage Barry Warsaw <barry@debian.org> - 2017-08-04 17:50 +0200
        Re: MBF for deprecating Python2 usage Scott Kitterman <debian@kitterman.com> - 2017-08-04 23:10 +0200
          Re: MBF for deprecating Python2 usage Barry Warsaw <barry@debian.org> - 2017-08-05 03:40 +0200
            Re: MBF for deprecating Python2 usage Scott Kitterman <debian@kitterman.com> - 2017-08-05 04:10 +0200
          Re: MBF for deprecating Python2 usage Geoffrey Thomas <geofft@ldpreload.com> - 2017-08-08 00:50 +0200
        Re: MBF for deprecating Python2 usage Diane Trout <diane@ghic.org> - 2017-08-08 00:00 +0200
          Re: MBF for deprecating Python2 usage Barry Warsaw <barry@debian.org> - 2017-08-08 00:50 +0200
            Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 01:40 +0200
              Re: MBF for deprecating Python2 usage Diane Trout <diane@ghic.org> - 2017-08-08 01:50 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 03:40 +0200
                Re: MBF for deprecating Python2 usage Barry Warsaw <barry@debian.org> - 2017-08-08 04:00 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 04:20 +0200
                Re: MBF for deprecating Python2 usage Diane Trout <diane@ghic.org> - 2017-08-08 05:10 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 05:30 +0200
                Re: MBF for deprecating Python2 usage Diane Trout <diane@ghic.org> - 2017-08-08 05:40 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 06:00 +0200
                Re: MBF for deprecating Python2 usage Barry Warsaw <barry@debian.org> - 2017-08-08 07:00 +0200
                Re: MBF for deprecating Python2 usage Geoffrey Thomas <geofft@ldpreload.com> - 2017-08-08 04:10 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 04:30 +0200
                Re: MBF for deprecating Python2 usage Diane Trout <diane@ghic.org> - 2017-08-08 05:20 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 05:40 +0200
                Re: MBF for deprecating Python2 usage Steve Langasek <vorlon@debian.org> - 2017-08-08 07:30 +0200
                Re: MBF for deprecating Python2 usage Ben Finney <bignose@debian.org> - 2017-08-08 08:20 +0200
                Re: MBF for deprecating Python2 usage Geoffrey Thomas <geofft@ldpreload.com> - 2017-08-10 17:40 +0200
                Re: MBF for deprecating Python2 usage Ole Streicher <olebole@debian.org> - 2017-08-08 21:20 +0200
                Re: MBF for deprecating Python2 usage Scott Kitterman <debian@kitterman.com> - 2017-08-08 21:30 +0200
    Re: MBF for deprecating Python2 usage Matthias Klose <doko@debian.org> - 2017-08-04 13:00 +0200
      Re: MBF for deprecating Python2 usage Scott Kitterman <debian@kitterman.com> - 2017-08-04 14:40 +0200
  Re: MBF for deprecating Python2 usage Adrian Bunk <bunk@debian.org> - 2017-08-07 00:00 +0200
  Re: MBF for deprecating Python2 usage Adrian Bunk <bunk@debian.org> - 2017-08-07 01:00 +0200
  Re: MBF for deprecating Python2 usage Christian Seiler <christian@iwakd.de> - 2017-08-07 01:10 +0200

csiph-web