On 6/2/21 8:37 PM, John Snow wrote:
> Closes: https://gitlab.com/qemu-project/qemu/-/issues/202
> GitLab: https://gitlab.com/jsnow/qemu/-/commits/python-package-qom
> CI: https://gitlab.com/jsnow/qemu/-/pipelines/313932818
>
> Hello!
> ------
>
> This series applies the usual linting cleanups to modernize the qom
> tools and then integrates them into the python packaging hierarchy.
>
> This will help prevent further bitrot of these tools.
>
> I don't expect or need a detailed review of the QOM tools themselves --
> these tools are not used during build OR testing, and some are fairly
> bitrotted in places.
>
> However, some details of how the python packaging system is being
> utilized here may attract your attention and could be worth a look.
> (Patches 5-6 and 16-19 are the interesting ones.)
>
> Since these scripts aren't critical, I'm OK with sending a fairly hasty
> PR to merge these sooner rather than later.
>
> Overview:
> ---------
>
> Patch 1: Update Pipfile.lock (See the commit as for why ...)
>
> Patches 2-3: Correct some existing typing issues in qemu.qmp
>
> Patch 4: Combine qom-set, qom-get, (etc) into one, newly written script
> that makes all of the command invocations, help text, etc. consistent.
> (I ask that review for this patch should be limited to critical
> mistakes: I have no interest in developing the QOM tools further.)
>
> Patches 5-6: Integrate the qom tools into the python package.
>
> Patches 7-15: Delinting of the qom_fuse script. Similarly, I am not
> terribly interested in further improvements here, personally.
>
> Patches 16-19: Integrating qom-fuse into the Python packaging directory;
> additional care is taken to ensure that "optional" dependencies like
> fusepy are handled well.
>
> Changelog
> ---------
>
> V3:
> - Technically, I sent two versions of this before, a long time ago.
> This has been cleaned up and based on the latest origin/master.
>
> John Snow (19):
> python/pipenv: Update Pipfile.lock
> python/qmp: Fix type of SocketAddrT
> python/qmp: add parse_address classmethod
> python/qmp: Add qom script rewrites
> python/qmp: add qom script entry points
> scripts/qmp: redirect qom-xxx scripts to python/qemu/qmp/
> scripts/qom-fuse: apply isort rules
> scripts/qom-fuse: apply flake8 rules
> python: Add 'fh' to known-good variable names
> scripts/qom-fuse: Apply pylint rules
> scripts/qom-fuse: Add docstrings
> scripts/qom-fuse: Convert to QOMCommand
> scripts/qom-fuse: use QOMCommand.qom_list()
> scripts/qom-fuse: ensure QOMFuse.read always returns bytes
> scripts/qom-fuse: add static type hints
> python: add optional FUSE dependencies
> scripts/qom-fuse: move to python/qemu/qmp/qom_fuse.py
> scripts/qom-fuse: add redirection shim to python/qemu/qmp/qom-fuse.py
> python/qmp: add fuse command to 'qom' tools
>
> python/Pipfile.lock | 97 +++++++++++-
> python/qemu/qmp/__init__.py | 28 +++-
> python/qemu/qmp/qom.py | 272 ++++++++++++++++++++++++++++++++++
> python/qemu/qmp/qom_common.py | 178 ++++++++++++++++++++++
> python/qemu/qmp/qom_fuse.py | 206 +++++++++++++++++++++++++
> python/setup.cfg | 33 ++++-
> scripts/qmp/qmp-shell | 21 +--
> scripts/qmp/qom-fuse | 144 +-----------------
> scripts/qmp/qom-get | 66 +--------
> scripts/qmp/qom-list | 63 +-------
> scripts/qmp/qom-set | 63 +-------
> scripts/qmp/qom-tree | 74 +--------
> 12 files changed, 828 insertions(+), 417 deletions(-)
> create mode 100644 python/qemu/qmp/qom.py
> create mode 100644 python/qemu/qmp/qom_common.py
> create mode 100644 python/qemu/qmp/qom_fuse.py
>
Provisionally staged to my Python branch:
https://gitlab.com/jsnow/qemu/-/commits/python/
(Barring objections, I intend to send a PR for all the ./scripts/qmp/
cleanups at once, next Friday.)
--js