All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-trivial <qemu-trivial@nongnu.org>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-trivial] [PATCH] configure: Don't write .pyc files by default (python -B)
Date: Thu, 14 Nov 2013 18:43:48 +0100	[thread overview]
Message-ID: <52850BD4.7080900@weilnetz.de> (raw)
In-Reply-To: <CAJSP0QVu2gZRu5t9MjO9MHphvJyiRU7W5MCyKZ2q3GWLffxCHw@mail.gmail.com>

Am 14.11.2013 15:45, schrieb Stefan Hajnoczi:
> On Tue, Aug 27, 2013 at 3:12 PM, Stefan Weil <sw@weilnetz.de> wrote:
>> When a Python script is run, Python normally writes bytecode into a .pyc file.
>> QEMU's build process uses several Python scripts which are called from
>> configure or make.
>>
>> The generated .pyc files take disk space without being of much use, because
>> those scripts are short, not time critical and only called a few times.
>>
>> Python's option -B disables writing of .pyc files. QEMU now uses "python -B"
>> as default, but it is still possible to choose a different call by passing
>> --python=PYTHON to configure.
>>
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>> ---
>>
>> It was necessary to change from "$python" to simply $python in the
>> Python test. This should not matter: we already have a simple $python
>> in configure, and Python wants to be installed in a path without
>> spaces.
>>
>> Stefan
[...]
>> This patch breaks ./configure on RHEL 5 and other older distros that
>> use Python 2.4.
>>
>> The version test in ./configure fails because the python interpreter
>> does not accept the -B option:
>> http://buildbot.b1-systems.de/qemu/builders/default_x86_64_rhel5/builds/762/steps/configure/logs/stdio
>>
>> Can you add -B after version detection, if available?  (No .pyc is
>> generated for statements evaluated on the command-line during version
>> detection.)
>>
>> Stefan

I'm sorry that I did not notice this regression in the buildbot report.

We have several possibilities how we can handle this incompatibility for
old versions of Python.

According to http://docs.python.org/2/whatsnew/2.6.html, the -B option
was introduced with
Python 2.6 which was released on October 1 2008.

Solution 1: We don't modify the current configure script because it
works with Python versions
since 5 years. For older versions there is a very simple workaround:
call configure with
--python=python. This additional parameter would also be needed for the
buildbots running
with Python 2.4.

Solution 2: I modify the configure script to set -B only if it is
supported. This makes it marginally
longer (more lines of code, one more Python execution).

Would 1 be sufficient, or do you prefer getting a patch with solution 2?
In any case, I don't think
this is a must for QEMU 1.7.

Stefan



WARNING: multiple messages have this Message-ID (diff)
From: Stefan Weil <sw@weilnetz.de>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-trivial <qemu-trivial@nongnu.org>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] configure: Don't write .pyc files by default (python -B)
Date: Thu, 14 Nov 2013 18:43:48 +0100	[thread overview]
Message-ID: <52850BD4.7080900@weilnetz.de> (raw)
In-Reply-To: <CAJSP0QVu2gZRu5t9MjO9MHphvJyiRU7W5MCyKZ2q3GWLffxCHw@mail.gmail.com>

Am 14.11.2013 15:45, schrieb Stefan Hajnoczi:
> On Tue, Aug 27, 2013 at 3:12 PM, Stefan Weil <sw@weilnetz.de> wrote:
>> When a Python script is run, Python normally writes bytecode into a .pyc file.
>> QEMU's build process uses several Python scripts which are called from
>> configure or make.
>>
>> The generated .pyc files take disk space without being of much use, because
>> those scripts are short, not time critical and only called a few times.
>>
>> Python's option -B disables writing of .pyc files. QEMU now uses "python -B"
>> as default, but it is still possible to choose a different call by passing
>> --python=PYTHON to configure.
>>
>> Signed-off-by: Stefan Weil <sw@weilnetz.de>
>> ---
>>
>> It was necessary to change from "$python" to simply $python in the
>> Python test. This should not matter: we already have a simple $python
>> in configure, and Python wants to be installed in a path without
>> spaces.
>>
>> Stefan
[...]
>> This patch breaks ./configure on RHEL 5 and other older distros that
>> use Python 2.4.
>>
>> The version test in ./configure fails because the python interpreter
>> does not accept the -B option:
>> http://buildbot.b1-systems.de/qemu/builders/default_x86_64_rhel5/builds/762/steps/configure/logs/stdio
>>
>> Can you add -B after version detection, if available?  (No .pyc is
>> generated for statements evaluated on the command-line during version
>> detection.)
>>
>> Stefan

I'm sorry that I did not notice this regression in the buildbot report.

We have several possibilities how we can handle this incompatibility for
old versions of Python.

According to http://docs.python.org/2/whatsnew/2.6.html, the -B option
was introduced with
Python 2.6 which was released on October 1 2008.

Solution 1: We don't modify the current configure script because it
works with Python versions
since 5 years. For older versions there is a very simple workaround:
call configure with
--python=python. This additional parameter would also be needed for the
buildbots running
with Python 2.4.

Solution 2: I modify the configure script to set -B only if it is
supported. This makes it marginally
longer (more lines of code, one more Python execution).

Would 1 be sufficient, or do you prefer getting a patch with solution 2?
In any case, I don't think
this is a must for QEMU 1.7.

Stefan

  reply	other threads:[~2013-11-14 17:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-27 13:12 [Qemu-trivial] [PATCH] configure: Don't write .pyc files by default (python -B) Stefan Weil
2013-08-27 13:12 ` [Qemu-devel] " Stefan Weil
2013-09-01 15:15 ` [Qemu-trivial] " Michael Tokarev
2013-09-01 15:15   ` [Qemu-devel] " Michael Tokarev
2013-11-14 14:45 ` Stefan Hajnoczi
2013-11-14 14:45   ` [Qemu-devel] " Stefan Hajnoczi
2013-11-14 17:43   ` Stefan Weil [this message]
2013-11-14 17:43     ` Stefan Weil
2013-11-15  9:31     ` Stefan Hajnoczi
2013-11-15  9:31       ` [Qemu-devel] " Stefan Hajnoczi

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=52850BD4.7080900@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@gmail.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.