All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Costas Drogos <costas.drogos@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 1/1] QMP test code - qmp.py
Date: Wed, 7 Apr 2010 10:36:10 -0300	[thread overview]
Message-ID: <20100407103610.4080b945@redhat.com> (raw)
In-Reply-To: <w2g555ed20a1004061740rc79f0640y64b52334c63bb9d1@mail.gmail.com>

On Wed, 7 Apr 2010 03:40:32 +0300
Costas Drogos <costas.drogos@gmail.com> wrote:

> Hello there,
> 
> a very small patch to address two small issues:
> 
> 1) The json state in python2.5 and python2.6. json module is included
> by default on python2.6, whereas you have to import simplejson in
> python2.5. I have this problem on Debian testing, so feel free to test
> if this is applicable in your distribution.
> 
> 2) For qmp commands to work (e.g. query-kvm) we have to give first the
> command 'qmp_capabilities' because monitor is in 'Capabilities
> Negotiation mode' on startup. The patch takes care of issuing that
> command immediately after connecting.
> 
> The patch is more of a hack to ease qmp testing and development.

 I already have a new version of that script in the master branch of:

	git://repo.or.cz/qemu/qmp-unstable.git

 It fixes current problems and has other improvements, I didn't submit
it yet because I didn't test it much.

 So, I will add a fix for the json problem and would appreciate any testing.

> diff --git a/QMP/qmp.py b/QMP/qmp.py
> index d9da603..f8581c4 100644
> --- a/QMP/qmp.py
> +++ b/QMP/qmp.py
> @@ -8,7 +8,15 @@
>  # This work is licensed under the terms of the GNU GPL, version 2.  See
>  # the COPYING file in the top-level directory.
> 
> -import socket, json
> +import socket
> +
> +from sys import version
> +ver = version[:3]
> +
> +if ver == '2.6':
> +    import json
> +else:
> +    import simplejson as json

 This won't do what we want for 2.7 and newer, so a better if would be:

if sys.version_info < (2, 6):
    import simplejson as json
else:
    import json

  reply	other threads:[~2010-04-07 13:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07  0:40 [Qemu-devel] [PATCH 1/1] QMP test code - qmp.py Costas Drogos
2010-04-07 13:36 ` Luiz Capitulino [this message]
2010-04-07 13:51   ` [Qemu-devel] " Avi Kivity
2010-04-07 14:38     ` Costas Drogos

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=20100407103610.4080b945@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=costas.drogos@gmail.com \
    --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.