All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Nguyen <tony.nguyen@bt.com>
To: Cleber Rosa <crosa@redhat.com>
Cc: Julio Montes <julio.montes@intel.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org, Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] configure: more resilient Python version capture
Date: Tue, 27 Aug 2019 10:31:24 +1000	[thread overview]
Message-ID: <20190827003124.GA23751@imac.local> (raw)
In-Reply-To: <20190826155832.17427-1-crosa@redhat.com>

On Mon, Aug 26, 2019 at 11:58:32AM -0400, Cleber Rosa wrote:
> The current approach to capture the Python version is fragile, as it
> was demonstrated by a very specific build of Python 3 on Fedora 29
> that, under non-interactive shells would print multiline version
> information.
> 
> The (badly) stripped version output would be sent to config-host.mak,
> producing bad syntax and rendering the makefiles unusable.  Now, the
> Python versions is printed by configure, but only a simple (and better
> controlled variable) indicating whether the build system is using
> Python 2 is kept on config-host.mak.
> 
> Signed-off-by: Cleber Rosa <crosa@redhat.com>
> 
> ---
> v2: Use python from '$python' variable instead of hardcoded 'python2'
> ---
>  configure              | 5 +++--
>  tests/Makefile.include | 2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index e44e454c43..95134c0180 100755
> --- a/configure
> +++ b/configure
> @@ -1864,7 +1864,7 @@ if ! $python -c 'import sys; sys.exit(sys.version_info < (2,7))'; then
>  fi
>  
>  # Preserve python version since some functionality is dependent on it
> -python_version=$($python -V 2>&1 | sed -e 's/Python\ //')
> +python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null)
>  
>  # Suppress writing compiled files
>  python="$python -B"
> @@ -6511,6 +6511,7 @@ if ! $python -c 'import sys; sys.exit(sys.version_info < (3,0))'; then
>    echo
>    echo "warning: Python 2 support is deprecated" >&2
>    echo "warning: Python 3 will be required for building future versions of QEMU" >&2
> +  python2="y"
>  fi
>  
>  config_host_mak="config-host.mak"
> @@ -7333,7 +7334,7 @@ echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
>  echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
>  echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
>  echo "PYTHON=$python" >> $config_host_mak
> -echo "PYTHON_VERSION=$python_version" >> $config_host_mak
> +echo "PYTHON2=$python2" >> $config_host_mak
>  echo "CC=$cc" >> $config_host_mak
>  if $iasl -h > /dev/null 2>&1; then
>    echo "IASL=$iasl" >> $config_host_mak
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index 49684fd4f4..f5ac09549c 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -1135,7 +1135,7 @@ TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
>  AVOCADO_SHOW=app
>  AVOCADO_TAGS=$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGET_DIRS)))
>  
> -ifneq ($(findstring v2,"v$(PYTHON_VERSION)"),v2)
> +ifneq ($(PYTHON2),y)
>  $(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
>  	$(call quiet-command, \
>              $(PYTHON) -m venv --system-site-packages $@, \
> -- 
> 2.21.0
> 
> 

Reviewed-by: Tony Nguyen <tony.nguyen@bt.com>


  reply	other threads:[~2019-08-27  0:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 15:58 [Qemu-devel] [PATCH v2] configure: more resilient Python version capture Cleber Rosa
2019-08-27  0:31 ` Tony Nguyen [this message]
2019-08-27 20:07 ` Eduardo Habkost

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=20190827003124.GA23751@imac.local \
    --to=tony.nguyen@bt.com \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=julio.montes@intel.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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 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.