All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Daniel Berrange" <berrange@redhat.com>,
	"Beraldo Leal" <bleal@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	Qemu-block <qemu-block@nongnu.org>,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Kevin Wolf" <kwolf@redhat.com>
Subject: Re: [PATCH v2 3/7] configure: Look for auxiliary Python installations
Date: Fri, 10 Feb 2023 17:17:32 +0100	[thread overview]
Message-ID: <CABgObfa79AStZ8DnGEs2GmdZeLecijW3Um9O4XmguVNLwdfs2g@mail.gmail.com> (raw)
In-Reply-To: <CAFn=p-Yyus2zipaUgLwonpMRdfZp-CKEisiXgZBLjgG6UxXagw@mail.gmail.com>

On Fri, Feb 10, 2023 at 4:28 PM John Snow <jsnow@redhat.com> wrote:
> PS, while you're here, how does this new loop interfere with your "custom python specified" flag for meson? I think meson uses the version of python *it* detects and not the configure script identified one, right? Does that mean that e.g. the qapi generator gets run with the system default/meson version and not the config version?

Yes, if neither --python nor --meson are specified, then it could
happen that a different python is used during ninja's execution vs.
what is used for "other stuff" (docker cross compilers and other
Makefile invocations of $(PYTHON)).

The meson version of Python is guaranteed to be at least 3.7 as soon
as we update to 0.63.x (which will be Real Soon Now), but it's ugly.
The main issue I anticipate could be a problem when running from a
virtual environment, so perhaps we can force usage of the internal
meson if neither --python nor --meson are specified, and VIRTUAL_ENV
is set and $VIRTUAL_ENV/bin/meson does not exist?

diff --git a/configure b/configure
index 06bcd9031903..001a79a90170 100755
--- a/configure
+++ b/configure
@@ -870,8 +870,18 @@ fi
 # Suppress writing compiled files
 python="$python -B"

+has_meson() {
+  if test "${VIRTUAL_ENV:+set}" = set; then
+    # Ensure that Meson and Python come from the same virtual environment
+    test -x "$(VIRTUAL_ENV}/bin/meson" &&
+      test "$(command -v meson)" -ef "$(VIRTUAL_ENV}/bin/meson"
+  else
+    has meson
+  fi
+}
+
 if test -z "$meson"; then
-    if test "$explicit_python" = no && has meson && version_ge
"$(meson --version)" 0.63.0; then
+    if test "$explicit_python" = no && has_meson && version_ge
"$(meson --version)" 0.63.0; then
         meson=meson
     elif test "$git_submodules_action" != 'ignore' ; then
         meson=git

I will include it when posting the final series.

> Do I need to adjust this loop to consider more binaries as "explicitly specified"?

I don't think it's a huge problem. Outside virtual environments, the
most likely setting is that Meson uses python3 which in turn is the
most recent python3.X, so it should be fine overall.

Though part of me thinks that your new loop is slightly overengineered
and we should just require /usr/bin/env python3 and call it a day.

Paolo



  parent reply	other threads:[~2023-02-10 16:18 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10  0:31 [PATCH v2 0/7] Python: Drop support for Python 3.6 John Snow
2023-02-10  0:31 ` [PATCH v2 1/7] python: support pylint 2.16 John Snow
2023-02-10  0:31 ` [PATCH v2 2/7] python: drop pipenv John Snow
2023-02-10  0:31 ` [PATCH v2 3/7] configure: Look for auxiliary Python installations John Snow
2023-02-10  7:39   ` Thomas Huth
2023-02-10 10:45   ` Paolo Bonzini
2023-02-10 15:28     ` John Snow
2023-02-10 15:53       ` Peter Maydell
2023-02-10 16:17       ` Paolo Bonzini [this message]
2023-02-10 16:21         ` John Snow
2023-02-10 16:26           ` Paolo Bonzini
2023-02-10 19:56       ` Eric Blake
2023-02-10  0:31 ` [PATCH v2 4/7] configure: Add nice hint to Python failure message John Snow
2023-02-10  7:45   ` Thomas Huth
2023-02-10 19:19     ` John Snow
2023-02-10  0:31 ` [PATCH v2 5/7] DO-NOT-MERGE: testing: Add Python >= 3.7 to Centos, OpenSuSE John Snow
2023-02-10  0:31 ` [PATCH v2 6/7] CI: Stop building docs on centos8 John Snow
2023-02-10  7:06   ` Philippe Mathieu-Daudé
2023-02-10 10:41   ` Peter Maydell
2023-02-10 16:01     ` John Snow
2023-02-10 16:32       ` Peter Maydell
2023-02-10 16:51         ` Daniel P. Berrangé
2023-02-10 17:15           ` Peter Maydell
2023-02-10 18:27             ` Paolo Bonzini
2023-02-15 12:30               ` Daniel P. Berrangé
2023-02-14  7:40           ` Markus Armbruster
2023-02-14  8:35             ` Thomas Huth
2023-02-14  9:59               ` Alex Bennée
2023-02-14 12:10               ` Daniel P. Berrangé
2023-02-16  1:08                 ` Markus Armbruster
2023-02-16 11:00                   ` Daniel P. Berrangé
2023-02-14 10:33             ` Peter Maydell
2023-02-14 11:03             ` Kevin Wolf
2023-02-15 19:17               ` Markus Armbruster
2023-02-14 11:48             ` Daniel P. Berrangé
2023-02-14 14:03               ` Paolo Bonzini
2023-02-14 14:17                 ` Daniel P. Berrangé
2023-02-14 17:26                 ` Kevin Wolf
2023-02-14 20:52                   ` Paolo Bonzini
2023-02-15 10:38                     ` Kevin Wolf
2023-02-15 11:35                     ` Daniel P. Berrangé
2023-02-16  1:46                       ` Markus Armbruster
2023-02-16 11:06                         ` Daniel P. Berrangé
2023-02-17 22:49                   ` John Snow
2023-02-20  8:51                     ` Markus Armbruster
2023-02-16 11:12                 ` Daniel P. Berrangé
2023-02-16 10:40               ` Markus Armbruster
2023-02-10 17:55         ` John Snow
2023-02-10 18:09           ` Peter Maydell
2023-02-10 20:31             ` Paolo Bonzini
2023-02-10  0:31 ` [PATCH v2 7/7] Python: Drop support for Python 3.6 John Snow
2023-02-10 10:04 ` [PATCH v2 0/7] " Markus Armbruster
2023-02-14 18:35 ` John Snow
2023-02-15 10:53   ` Kevin Wolf
2023-02-15 19:05 ` Markus Armbruster
2023-02-16 10:17   ` Peter Maydell
2023-02-16 12:31     ` Markus Armbruster
2023-02-16 10:58   ` Thomas Huth
2023-02-17  9:06     ` Markus Armbruster
2023-02-17  9:56       ` Thomas Huth
2023-02-17 15:37         ` Peter Maydell
2023-02-17 15:41           ` Daniel P. Berrangé
2023-02-17 10:01       ` Daniel P. Berrangé
2023-02-17 20:46     ` John Snow
2023-02-20  6:16       ` Thomas Huth
2023-02-20 19:56         ` John Snow
2023-02-21 12:00           ` Thomas Huth
2023-02-17 11:37 ` Proposed way forward " Daniel P. Berrangé
2023-02-17 13:46   ` Thomas Huth
2023-02-17 13:52     ` Daniel P. Berrangé
2023-02-17 14:40   ` Paolo Bonzini

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=CABgObfa79AStZ8DnGEs2GmdZeLecijW3Um9O4XmguVNLwdfs2g@mail.gmail.com \
    --to=pbonzini@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=bleal@redhat.com \
    --cc=crosa@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.