qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/7] python/qemu: create qemu.lib module


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH 1/7] python/qemu: create qemu.lib module
Date: Fri, 5 Jun 2020 15:33:17 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1

03.06.2020 03:15, John Snow wrote:
move python/qemu/*.py to python/qemu/core/*.py.

To create a namespace package, the 'qemu' directory itself shouldn't
have module files in it. Thus, these files will go under a 'lib' package
directory instead.

Bolster the core/__init__.py file a little bit, Make the top-level
classes and functions available directly inside the `qemu.core`
namespace, to facilitate a convenient shorthand:

from qemu.core import QEMUQtestMachine, QEMUMonitorProtocol

Lastly, update all of the existing import directives.

(Note: these scripts were not necessarily tested to see if they still
work. Some of these scripts are in obvious states of disrepair and it is
beyond the scope of this patch to attempt to fix them.)


RFC: For now, I have used the 'qemu.core' namespace to provide a group
of related tools. I liked Daniel's suggestion of using qemu.machine (and
possible qemu.monitor), but that requires me to rewrite the import
statements and understand a bit more about how to configure
pylint/mypy/flake8 and it's not right to focus on that right now. In the
interest of expedience, I've chosen to keep everything in one package to
be able to send another RFC patchset.

Signed-off-by: John Snow <jsnow@redhat.com>
---

[..]

--- a/scripts/render_block_graph.py
+++ b/scripts/render_block_graph.py
@@ -25,10 +25,8 @@
  from graphviz import Digraph
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
-from qemu.qmp import (
-    QEMUMonitorProtocol,
-    QMPResponseError,
-)
+from qemu.core import QEMUMonitorProtocol
+from qemu.core.machine import MonitorResponseError

it should be
+from qemu.core.qmp import QMPResponseError

with that fixed:
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>



--
Best regards,
Vladimir



reply via email to

[Prev in Thread] Current Thread [Next in Thread]