public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/109668] New: 'python' vs. 'python3'
@ 2023-04-28 12:35 tschwinge at gcc dot gnu.org
  2023-05-09 11:41 ` [Bug other/109668] " marxin at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2023-04-28 12:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109668

            Bug ID: 109668
           Summary: 'python' vs. 'python3'
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
  Target Milestone: ---

In GCC sources, there exist a number of Python scripts that invoke 'python'
(for example, 'contrib/dg-extract-results.sh'), or '/usr/bin/python' (for
example, 'contrib/dg-extract-results.py').

Now, in my new Ubuntu 22.04 "jammy" installation, '/usr/bin/python' doesn't
exist anymore, but only '/usr/bin/python3'.

Do we intend to adjust all GCC's Python scripts to handle this scenario in some
generic way, or do we continue to require 'python' for GCC?

The latter may, for example, be achieved with Debian/Ubuntu package
python-is-python3:

    [...]
    Description: symlinks /usr/bin/python to python3
     Starting with the Debian 11 (bullseye) and Ubuntu 20.04 LTS (focal)
     releases, all python packages use explicit python3 or python2
     interpreter and do not use unversioned /usr/bin/python at all. Some
     third-party code is now predominantly python3 based, yet may use
     /usr/bin/python.
    [...]

Conversely, the already exist a number of explicitly 'python3' instances in GCC
sources, too.

---

I noticed this via the shell version 'contrib/dg-extract-results.sh' producing
different results than the Python version 'contrib/dg-extract-results.py' that
I had been using before (via 'contrib/dg-extract-results.sh' invoking it), but
no longer due to no 'python' executable being available anymore.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug other/109668] 'python' vs. 'python3'
  2023-04-28 12:35 [Bug other/109668] New: 'python' vs. 'python3' tschwinge at gcc dot gnu.org
@ 2023-05-09 11:41 ` marxin at gcc dot gnu.org
  2023-10-24  7:46 ` piannetta at kalrayinc dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-05-09 11:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109668

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Well, python2 is long time out of support and should not be used.
I think the correct Shebang for Python3 today is:
#!/usr/bin/env python3

and all the remaining Python2 scripts should be ported to Python3.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug other/109668] 'python' vs. 'python3'
  2023-04-28 12:35 [Bug other/109668] New: 'python' vs. 'python3' tschwinge at gcc dot gnu.org
  2023-05-09 11:41 ` [Bug other/109668] " marxin at gcc dot gnu.org
@ 2023-10-24  7:46 ` piannetta at kalrayinc dot com
  2024-02-09 16:55 ` palmer at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: piannetta at kalrayinc dot com @ 2023-10-24  7:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109668

Paul Iannetta <piannetta at kalrayinc dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |piannetta at kalrayinc dot com

--- Comment #2 from Paul Iannetta <piannetta at kalrayinc dot com> ---
My first guess was that unless GCC made clear that it will requires Python3, I
thought that all the Python scripts should be kept compatible with both Python2
and Python3.

However, looking at GCC sources, most python files already require python3 in
their shebang (#!/usr/bin/env python3), which would suggest that we can safely
drop python2 and use python3 everywhere, and rewrite the few #!/usr/bin/python3
to #!/usr/bin/env python3

% find gcc/ -iname "*.py" -exec head -n 1 '{}' + | grep "python$" -C 1
==> ./libstdc++-v3/scripts/make_graph.py <==
#!/usr/bin/python

==> ./libffi/generate-darwin-source-and-headers.py <==
#!/usr/bin/env python

==> ./contrib/jit-coverage-report.py <==
#! /usr/bin/python

==> ./contrib/dg-extract-results.py <==
#!/usr/bin/python

==> ./contrib/unused_functions.py <==
#!/usr/bin/env python

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug other/109668] 'python' vs. 'python3'
  2023-04-28 12:35 [Bug other/109668] New: 'python' vs. 'python3' tschwinge at gcc dot gnu.org
  2023-05-09 11:41 ` [Bug other/109668] " marxin at gcc dot gnu.org
  2023-10-24  7:46 ` piannetta at kalrayinc dot com
@ 2024-02-09 16:55 ` palmer at gcc dot gnu.org
  2024-02-23  4:36 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: palmer at gcc dot gnu.org @ 2024-02-09 16:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109668

palmer at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |palmer at gcc dot gnu.org

--- Comment #3 from palmer at gcc dot gnu.org ---
Jan-Benedict Glaw is reporting (via a crosstool-ng bug
<https://github.com/crosstool-ng/crosstool-ng/issues/2039>) that we've got a
few python2 scripts in the RISC-V port that can just be converted over.  I just
sent along a patch to clean that up.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug other/109668] 'python' vs. 'python3'
  2023-04-28 12:35 [Bug other/109668] New: 'python' vs. 'python3' tschwinge at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-02-09 16:55 ` palmer at gcc dot gnu.org
@ 2024-02-23  4:36 ` cvs-commit at gcc dot gnu.org
  2024-03-08 14:27 ` cvs-commit at gcc dot gnu.org
  2024-03-15 23:29 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-23  4:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109668

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kito Cheng <kito@gcc.gnu.org>:

https://gcc.gnu.org/g:23f5da91ccb4927562ea4d1c245639bfd4a0088b

commit r14-9144-g23f5da91ccb4927562ea4d1c245639bfd4a0088b
Author: Palmer Dabbelt <palmer@rivosinc.com>
Date:   Fri Feb 9 08:53:24 2024 -0800

    RISC-V: Point our Python scripts at python3

    This builds for me, and I frequently have python-is-python3 type
    packages installed so I think I've been implicitly testing it for a
    while.  Looks like Kito's tested similar configurations, and the
    bugzilla indicates we should be moving over.

    gcc/ChangeLog:

            PR other/109668
            * config/riscv/arch-canonicalize: Move to python3
            * config/riscv/multilib-generator: Likewise

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug other/109668] 'python' vs. 'python3'
  2023-04-28 12:35 [Bug other/109668] New: 'python' vs. 'python3' tschwinge at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-02-23  4:36 ` cvs-commit at gcc dot gnu.org
@ 2024-03-08 14:27 ` cvs-commit at gcc dot gnu.org
  2024-03-15 23:29 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-08 14:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109668

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:64273a7e6bd8ba60058174d147521dd65d705637

commit r14-9393-g64273a7e6bd8ba60058174d147521dd65d705637
Author: Sam James <sam@gentoo.org>
Date:   Fri Mar 8 15:24:20 2024 +0100

    contrib: Improve dg-extract-results.sh's Python detection [PR109668]

    'python' on some systems (e.g. SLES 15) might be Python 2. Prefer python3,
    then python, then python2 (as the script still tries to work there).

            PR other/109668
            * dg-extract-results.sh: Check for python3 before python. Check for
            python2 last.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug other/109668] 'python' vs. 'python3'
  2023-04-28 12:35 [Bug other/109668] New: 'python' vs. 'python3' tschwinge at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-03-08 14:27 ` cvs-commit at gcc dot gnu.org
@ 2024-03-15 23:29 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-15 23:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109668

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:8c4785e77e8b54109fbb4f81a3b624e98184c2aa

commit r13-8449-g8c4785e77e8b54109fbb4f81a3b624e98184c2aa
Author: Sam James <sam@gentoo.org>
Date:   Fri Mar 8 15:24:20 2024 +0100

    contrib: Improve dg-extract-results.sh's Python detection [PR109668]

    'python' on some systems (e.g. SLES 15) might be Python 2. Prefer python3,
    then python, then python2 (as the script still tries to work there).

            PR other/109668
            * dg-extract-results.sh: Check for python3 before python. Check for
            python2 last.

    (cherry picked from commit 64273a7e6bd8ba60058174d147521dd65d705637)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-03-15 23:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-28 12:35 [Bug other/109668] New: 'python' vs. 'python3' tschwinge at gcc dot gnu.org
2023-05-09 11:41 ` [Bug other/109668] " marxin at gcc dot gnu.org
2023-10-24  7:46 ` piannetta at kalrayinc dot com
2024-02-09 16:55 ` palmer at gcc dot gnu.org
2024-02-23  4:36 ` cvs-commit at gcc dot gnu.org
2024-03-08 14:27 ` cvs-commit at gcc dot gnu.org
2024-03-15 23:29 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).