From: Sam James <sam@gentoo.org>
To: gcc-patches@gcc.gnu.org
Cc: law@gcc.gnu.org, rguenth@gcc.gnu.org, Sam James <sam@gentoo.org>
Subject: [PATCH] contrib: Improve dg-extract-results.sh's Python detection
Date: Thu, 7 Mar 2024 14:16:37 +0000 [thread overview]
Message-ID: <20240307141638.153366-1-sam@gentoo.org> (raw)
'python' on some systems (e.g. SLES 15) might be Python 2. Prefer ${EPYTHON}
if defined (used by Gentoo's python-exec wrapping), then python3, then python.
contrib/ChangeLog:
* dg-extract-results.sh: Check for python3 before python.
---
| 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
--git a/contrib/dg-extract-results.sh b/contrib/dg-extract-results.sh
index 00ef80046f74..2d1cd76fe255 100755
--- a/contrib/dg-extract-results.sh
+++ b/contrib/dg-extract-results.sh
@@ -28,14 +28,17 @@
PROGNAME=dg-extract-results.sh
-# Try to use the python version if possible, since it tends to be faster.
+# Try to use the python version if possible, since it tends to be faster and
+# produces more stable results.
PYTHON_VER=`echo "$0" | sed 's/sh$/py/'`
-if test "$PYTHON_VER" != "$0" &&
- test -f "$PYTHON_VER" &&
- python -c 'import sys, getopt, re, io, datetime, operator; sys.exit (0 if sys.version_info >= (2, 6) else 1)' \
- > /dev/null 2> /dev/null; then
- exec python $PYTHON_VER "$@"
-fi
+for python in ${EPYTHON:-python3} python ; do
+ if test "$PYTHON_VER" != "$0" &&
+ test -f "$PYTHON_VER" &&
+ ${python} -c 'import sys, getopt, re, io, datetime, operator; sys.exit (0 if sys.version_info >= (2, 6) else 1)' \
+ > /dev/null 2> /dev/null; then
+ exec ${python} $PYTHON_VER "$@"
+ fi
+done
usage() {
cat <<EOF >&2
--
2.44.0
next reply other threads:[~2024-03-07 14:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 14:16 Sam James [this message]
2024-03-07 14:21 ` Jakub Jelinek
2024-03-07 14:25 ` Sam James
2024-03-07 14:26 ` Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240307141638.153366-1-sam@gentoo.org \
--to=sam@gentoo.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@gcc.gnu.org \
--cc=rguenth@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).