Skip to contentSkip to conversation

python: drop qemu.qmp from qemu.git tree

PATCH Superseded John Snow 2 participants 26 messages Feb 16 – Feb 17 Arm/Amlogic Meson SoC support

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

John Snow

author
#0 lore raw

v7 cover python: drop qemu.qmp from qemu.git tree

Hello!

This series drops the in-tree version of our python-qemu-qmp package ("qemu.qmp") in favor of the version hosted on PyPI, whose repository is located at https://gitlab.com/qemu-project/python-qemu-qmp.

GitLab CI: https://gitlab.com/jsnow/qemu/-/pipelines/2329875804

The major effects of this patch series are:

1. qemu.qmp and the python/ directory will be installed to the configure-time venv (build/pyvenv) by default.
2. qemu.qmp will be installed from PyPI or vendored packages instead of being utilized directly from the qemu.git tree.
3. "make check-venv" is removed as it is no longer needed.
4. functional test dependencies are installed as-needed when running those tests.
5. Unfortunately, python3-wheel and python3-setuptools are now required on the host system if tests are to be executed and >= Python 3.13 is used.
6. An awful lot of deleted lines of code, and a lot fewer headaches managing two nearly-identical copies of this source code. O:-)

v7:

- Fixed OpenBSD VM test
- Fixed a recently failing MacOS test, by...
- Upgraded lcitool to latest version
- Upgraded Fedora from 41 -> 43
- Upgraded Alpine from 3.21 -> 3.23
- Included contrig/plugins/cpp fix for CI testing purposes
- Added minimum versions for setuptools and wheel to pythondeps.toml

Note that v7 sees a new(?) failure in check-rust-tools-nightly as a result of the Fedora 43 upgrade. I think this series has spiralled out of control trying to keep the CI green and I am not familiar enough with our rust tooling to go and fix this myself. The tox test is *also* still failing, but not because of this series - and will be fixed in a separate series that updates our Python testing.

v6:

- Added workaround for configure-less VM tests

v5:

- Changed the local package install mechanism as per Paolo's advice
- Changed "file://" mechanism for local installs, following the msys2 test fixes upstream that did the same
- Fix typo in cover letter (thuth)
- Fixed comments around mkvenv invocations; functests group will *always* use the --online flag, whether or not it was configured. (danpb)
- Please, let this nightmare be over

v4:

- Rename "checktests" group to "tooling", install it by default alongside meson at configure-time.
- Remove "check-venv" entirely.
- Update python/README.rst to reflect the new paradigm
- Update many scripts that import qemu.qmp to give new errors when they are run outside of the configure venv

KNOWN ISSUES IN V4:

- The last patch is an RFC based on Thomas' observations, I don't have a strong opinion on if we want it or not.
- Removing "make check-venv" causes the VM tests to rebuild more often; I was not sure how to replace the old conditional behavior in an equivalent manner. Suggestions, anyone...?

v3:

- Fixed FreeBSD vm test
- Fixed Cirrus macOS test (Needed setuptools as a dep, "file:///" had one too many forward slashes, which works fine for older pip/setuptools, but was incompatibly fixed recently.)
- Fixed an issue that prevented installing the local python packages in an offline, isolated build environment (need --no-isolated-build and pip environment variable flags)
- Added the python3-wheel and python3-setuptools build dependencies to lcitool, owing to the above issues
- Ensured that the $download flag (for PyPI access) from configure is carried over into pytest/meson.build invocations. This defaults to "enabled", so test dependencies should not have any issue being fetched on most developer workstations and build environments.
- Fixed several bugs in the mkvenv.py local package installation mechanism.
- Flags and workarounds added for installing local packages offline now apply *only* to local package installations, and not "normal" depspecs.
- Reordered patches into more logical "phases" for easier review (I hope...?)

Known issues: "make check-build" still installs all of the test dependencies to the pyvenv. I'm not sure if this is desired or not, but I ran into problems preventing it from doing this without breaking a ton of CI tests. I'll continue to investigate this, but wanted to send this v3 out.

v2:

- move "make check-venv" earlier in GitLab CI/CD pipeline, to avoid re-running configure
- Fix functional tests not using PyPI to fetch pygdbmi package
- Remove pre-requisites which are now merged

--js

John Snow (18):
python/mkvenv: create timestamp file for each group "ensured" python/mkvenv: bump 'qemu.qmp' dependency for testdeps python/mkvenv: add 'tooling' and 'functests' dependency groups python/mkvenv: add mechanism to install local package(s) meson, mkvenv: add functests custom target
tests: Use configured python to run GitLab iotests
tests: use "run" script to execute device-crash-test tests/lcitool: update lcitool to latest version tests/lcitool: add python3 wheel and setuptools deps for qemu
python: add vendored qemu.qmp package
meson, mkvenv: make functional tests depend on functests group meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml
configure: unconditionally install "tooling" group
tests: replace check-venv with vm-venv target
scripts: nudge users to use 'run' script for scripts that import
qemu.qmp
python: delete qemu.qmp
python: update README.rst to reflect qemu.qmp's removal
python: add setuptools and wheel dependencies

Pierrick Bouvier (1):
[do-not-merge] contrib/plugins/cpp: use __has_include

 python/README.rst                             |   52 +-
 configure                                     |    2 +-
 meson.build                                   |    1 +
 .gitlab-ci.d/buildtest.yml                    |   26 +-
 .gitlab-ci.d/cirrus/freebsd-14.vars           |    2 +-
 .gitlab-ci.d/cirrus/macos-14.vars             |    2 +-
 .gitlab-ci.d/windows.yml                      |    2 +
 contrib/plugins/cpp.cpp                       |  261 +++-
 python/qemu/qmp/__init__.py                   |   60 -
 python/qemu/qmp/error.py                      |   53 -
 python/qemu/qmp/events.py                     |  751 -----------
 python/qemu/qmp/legacy.py                     |  339 -----
 python/qemu/qmp/message.py                    |  217 ----
 python/qemu/qmp/models.py                     |  146 ---
 python/qemu/qmp/protocol.py                   | 1101 -----------------
 python/qemu/qmp/py.typed                      |    0
 python/qemu/qmp/qmp_client.py                 |  732 -----------
 python/qemu/qmp/qmp_shell.py                  |  689 -----------
 python/qemu/qmp/qmp_tui.py                    |  665 ----------
 python/qemu/qmp/util.py                       |  150 ---
 python/qemu/utils/qom_fuse.py                 |    1 -
 python/scripts/mkvenv.py                      |   43 +-
 python/scripts/vendor.py                      |    2 +
 python/setup.cfg                              |   31 +-
 python/tests/minreqs.txt                      |    8 +-
 python/tests/protocol.py                      |  596 ---------
 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl |  Bin 0 -> 72263 bytes
 pythondeps.toml                               |   21 +-
 pyvenv/meson.build                            |   27 +
 scripts/compare-machine-types.py              |    7 +-
 scripts/device-crash-test                     |    5 +-
 scripts/qmp/qemu-ga-client                    |   13 +-
 scripts/qmp/qmp-shell                         |   13 +-
 scripts/qmp/qmp-shell-wrap                    |   13 +-
 scripts/qmp/qom-fuse                          |   13 +-
 scripts/qmp/qom-get                           |   13 +-
 scripts/qmp/qom-list                          |   13 +-
 scripts/qmp/qom-set                           |   13 +-
 scripts/qmp/qom-tree                          |   13 +-
 scripts/qmp_helper.py                         |    9 +-
 scripts/render_block_graph.py                 |   10 +-
 scripts/simplebench/bench_block_job.py        |   10 +-
 tests/Makefile.include                        |   22 +-
 tests/docker/dockerfiles/alpine.docker        |    6 +-
 tests/docker/dockerfiles/centos9.docker       |  242 ++--
 .../dockerfiles/fedora-rust-nightly.docker    |  262 ++--
 .../dockerfiles/fedora-win64-cross.docker     |  162 +--
 tests/docker/dockerfiles/fedora.docker        |  262 ++--
 tests/docker/dockerfiles/opensuse-leap.docker |    1 +
 tests/functional/meson.build                  |    5 +-
 tests/lcitool/libvirt-ci                      |    2 +-
 tests/lcitool/mappings.yml                    |    2 +-
 tests/lcitool/projects/qemu.yml               |    2 +
 tests/lcitool/refresh                         |    8 +-
 tests/migration-stress/guestperf/engine.py    |   15 +-
 tests/vm/Makefile.include                     |   18 +-
 tests/vm/generated/freebsd.json               |    2 +
 tests/vm/openbsd                              |    3 +
 58 files changed, 996 insertions(+), 6143 deletions(-)
 delete mode 100644 python/qemu/qmp/__init__.py
 delete mode 100644 python/qemu/qmp/error.py
 delete mode 100644 python/qemu/qmp/events.py
 delete mode 100644 python/qemu/qmp/legacy.py
 delete mode 100644 python/qemu/qmp/message.py
 delete mode 100644 python/qemu/qmp/models.py
 delete mode 100644 python/qemu/qmp/protocol.py
 delete mode 100644 python/qemu/qmp/py.typed
 delete mode 100644 python/qemu/qmp/qmp_client.py
 delete mode 100644 python/qemu/qmp/qmp_shell.py
 delete mode 100644 python/qemu/qmp/qmp_tui.py
 delete mode 100644 python/qemu/qmp/util.py
 delete mode 100644 python/tests/protocol.py
 create mode 100644 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl
 create mode 100644 pyvenv/meson.build
Signature · 1 line
2.53.0
author
#1 lore raw

PATCH v7 1/19 contrib/plugins/cpp: use __has_include

From: Pierrick Bouvier <[email protected]>

(Included for the sake of proving this series does not cause any VM building regressions; this patch has been submitted separately upstream by pbo; this series does not otherwise depend on that patch. --js)

This make sure we can include all possible headers without breaking build for environments missing them. It fixes compilation on openbsd.

We don't want to pollute configure script, as it's really a special case here to make sure we don't have a compilation regression with qemu-plugins header.

---
 contrib/plugins/cpp.cpp | 261 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 259 insertions(+), 2 deletions(-)
contrib/plugins/cpp.cpp +259 -2
index 1ff54896d97..0673c4f074d 100644
@@ -6,103 +6,360 @@
 
 #include <qemu-plugin.h>
 
-/* https://en.cppreference.com/w/cpp/headers.html */
+/*
+ * We include all C++ standard headers (without deprecated ones),
+ * taken from: https://en.cppreference.com/w/cpp/headers.html
+ *
+ * To update, copy page text, and then:
+ * grep '^<' |
+ * sort -u |
+ * grep -v strstream |
+ * grep -v codecvt |
+ * sed -e 's/\(.*\)/#if __has_include(\1)\n#include \1\n#endif/'
+ */
+
+#if __has_include(<algorithm>)
 #include <algorithm>
+#endif
+#if __has_include(<any>)
 #include <any>
+#endif
+#if __has_include(<array>)
 #include <array>
+#endif
+#if __has_include(<atomic>)
 #include <atomic>
+#endif
+#if __has_include(<barrier>)
 #include <barrier>
+#endif
+#if __has_include(<bit>)
 #include <bit>
+#endif
+#if __has_include(<bitset>)
 #include <bitset>
+#endif
+#if __has_include(<cassert>)
 #include <cassert>
+#endif
+#if __has_include(<cctype>)
 #include <cctype>
+#endif
+#if __has_include(<cerrno>)
 #include <cerrno>
+#endif
+#if __has_include(<cfenv>)
 #include <cfenv>
+#endif
+#if __has_include(<cfloat>)
 #include <cfloat>
+#endif
+#if __has_include(<charconv>)
 #include <charconv>
+#endif
+#if __has_include(<chrono>)
 #include <chrono>
+#endif
+#if __has_include(<cinttypes>)
 #include <cinttypes>
+#endif
+#if __has_include(<climits>)
 #include <climits>
+#endif
+#if __has_include(<clocale>)
 #include <clocale>
+#endif
+#if __has_include(<cmath>)
 #include <cmath>
-#include <codecvt>
+#endif
+#if __has_include(<compare>)
 #include <compare>
+#endif
+#if __has_include(<complex>)
 #include <complex>
+#endif
+#if __has_include(<concepts>)
 #include <concepts>
+#endif
+#if __has_include(<condition_variable>)
 #include <condition_variable>
+#endif
+#if __has_include(<contracts>)
+#include <contracts>
+#endif
+#if __has_include(<coroutine>)
 #include <coroutine>
+#endif
+#if __has_include(<csetjmp>)
 #include <csetjmp>
+#endif
+#if __has_include(<csignal>)
 #include <csignal>
+#endif
+#if __has_include(<cstdarg>)
 #include <cstdarg>
+#endif
+#if __has_include(<cstddef>)
 #include <cstddef>
+#endif
+#if __has_include(<cstdint>)
 #include <cstdint>
+#endif
+#if __has_include(<cstdio>)
 #include <cstdio>
+#endif
+#if __has_include(<cstdlib>)
 #include <cstdlib>
+#endif
+#if __has_include(<cstring>)
 #include <cstring>
+#endif
+#if __has_include(<ctime>)
 #include <ctime>
+#endif
+#if __has_include(<cuchar>)
 #include <cuchar>
+#endif
+#if __has_include(<cwchar>)
 #include <cwchar>
+#endif
+#if __has_include(<cwctype>)
 #include <cwctype>
+#endif
+#if __has_include(<debugging>)
+#include <debugging>
+#endif
+#if __has_include(<deque>)
 #include <deque>
+#endif
+#if __has_include(<exception>)
 #include <exception>
+#endif
+#if __has_include(<execution>)
 #include <execution>
+#endif
+#if __has_include(<expected>)
+#include <expected>
+#endif
+#if __has_include(<filesystem>)
 #include <filesystem>
+#endif
+#if __has_include(<flat_map>)
+#include <flat_map>
+#endif
+#if __has_include(<flat_set>)
+#include <flat_set>
+#endif
+#if __has_include(<format>)
+#include <format>
+#endif
+#if __has_include(<forward_list>)
 #include <forward_list>
+#endif
+#if __has_include(<fstream>)
 #include <fstream>
+#endif
+#if __has_include(<functional>)
 #include <functional>
+#endif
+#if __has_include(<future>)
 #include <future>
+#endif
+#if __has_include(<generator>)
+#include <generator>
+#endif
+#if __has_include(<hazard_pointer>)
+#include <hazard_pointer>
+#endif
+#if __has_include(<hive>)
+#include <hive>
+#endif
+#if __has_include(<initializer_list>)
 #include <initializer_list>
+#endif
+#if __has_include(<inplace_vector>)
+#include <inplace_vector>
+#endif
+#if __has_include(<iomanip>)
 #include <iomanip>
+#endif
+#if __has_include(<ios>)
 #include <ios>
+#endif
+#if __has_include(<iosfwd>)
 #include <iosfwd>
+#endif
+#if __has_include(<iostream>)
 #include <iostream>
+#endif
+#if __has_include(<istream>)
 #include <istream>
+#endif
+#if __has_include(<iterator>)
 #include <iterator>
+#endif
+#if __has_include(<latch>)
 #include <latch>
+#endif
+#if __has_include(<limits>)
 #include <limits>
+#endif
+#if __has_include(<linalg>)
+#include <linalg>
+#endif
+#if __has_include(<list>)
 #include <list>
+#endif
+#if __has_include(<locale>)
 #include <locale>
+#endif
+#if __has_include(<map>)
 #include <map>
+#endif
+#if __has_include(<mdspan>)
+#include <mdspan>
+#endif
+#if __has_include(<memory>)
 #include <memory>
+#endif
+#if __has_include(<memory_resource>)
 #include <memory_resource>
+#endif
+#if __has_include(<mutex>)
 #include <mutex>
+#endif
+#if __has_include(<new>)
 #include <new>
+#endif
+#if __has_include(<numbers>)
 #include <numbers>
+#endif
+#if __has_include(<numeric>)
 #include <numeric>
+#endif
+#if __has_include(<optional>)
 #include <optional>
+#endif
+#if __has_include(<ostream>)
 #include <ostream>
+#endif
+#if __has_include(<print>)
+#include <print>
+#endif
+#if __has_include(<queue>)
 #include <queue>
+#endif
+#if __has_include(<random>)
 #include <random>
+#endif
+#if __has_include(<ranges>)
 #include <ranges>
+#endif
+#if __has_include(<ratio>)
 #include <ratio>
+#endif
+#if __has_include(<rcu>)
+#include <rcu>
+#endif
+#if __has_include(<regex>)
 #include <regex>
+#endif
+#if __has_include(<scoped_allocator>)
 #include <scoped_allocator>
+#endif
+#if __has_include(<semaphore>)
 #include <semaphore>
+#endif
+#if __has_include(<set>)
 #include <set>
+#endif
+#if __has_include(<shared_mutex>)
 #include <shared_mutex>
+#endif
+#if __has_include(<simd>)
+#include <simd>
+#endif
+#if __has_include(<source_location>)
 #include <source_location>
+#endif
+#if __has_include(<span>)
 #include <span>
+#endif
+#if __has_include(<spanstream>)
+#include <spanstream>
+#endif
+#if __has_include(<sstream>)
 #include <sstream>
+#endif
+#if __has_include(<stack>)
 #include <stack>
+#endif
+#if __has_include(<stacktrace>)
+#include <stacktrace>
+#endif
+#if __has_include(<stdexcept>)
 #include <stdexcept>
+#endif
+#if __has_include(<stdfloat>)
+#include <stdfloat>
+#endif
+#if __has_include(<stop_token>)
 #include <stop_token>
+#endif
+#if __has_include(<streambuf>)
 #include <streambuf>
+#endif
+#if __has_include(<string>)
 #include <string>
+#endif
+#if __has_include(<string_view>)
 #include <string_view>
+#endif
+#if __has_include(<syncstream>)
 #include <syncstream>
+#endif
+#if __has_include(<system_error>)
 #include <system_error>
+#endif
+#if __has_include(<text_encoding>)
+#include <text_encoding>
+#endif
+#if __has_include(<thread>)
 #include <thread>
+#endif
+#if __has_include(<tuple>)
 #include <tuple>
+#endif
+#if __has_include(<typeindex>)
 #include <typeindex>
+#endif
+#if __has_include(<typeinfo>)
 #include <typeinfo>
+#endif
+#if __has_include(<type_traits>)
 #include <type_traits>
+#endif
+#if __has_include(<unordered_map>)
 #include <unordered_map>
+#endif
+#if __has_include(<unordered_set>)
 #include <unordered_set>
+#endif
+#if __has_include(<utility>)
 #include <utility>
+#endif
+#if __has_include(<valarray>)
 #include <valarray>
+#endif
+#if __has_include(<variant>)
 #include <variant>
+#endif
+#if __has_include(<vector>)
 #include <vector>
+#endif
+#if __has_include(<version>)
 #include <version>
+#endif
 
 QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
 
Signature · 1 line
2.53.0
author
#2 lore raw

PATCH v7 2/19 python/mkvenv: create timestamp file for each group "ensured"

In reply to John Snow

Each group ensured by the mkvenv script will create an empty timestamp file named {groupname}.group which can be used to conditionally trigger dependency installation from various scripts and build machinery.

---
 python/scripts/mkvenv.py | 6 ++++++
 1 file changed, 6 insertions(+)
python/scripts/mkvenv.py +6 -0
index 5cba5770d22..b4662d33e6e 100644
@@ -838,6 +838,12 @@ def ensure_group(
             raise Ouch(result[0])
         raise SystemExit(f"\n{result[0]}\n\n")
 
+    if inside_a_venv():
+        for group in groups:
+            path = Path(sys.prefix).joinpath(f"{group}.group")
+            with open(path, "w", encoding="UTF8"):
+                pass
+
 
 def post_venv_setup() -> None:
     """
Signature · 1 line
2.53.0
author
#3 lore raw

PATCH v7 3/19 python/mkvenv: bump 'qemu.qmp' dependency for testdeps

In reply to John Snow

First up, use the newest v0.0.5 instead of the older v0.0.3.

Secondly, the use of a period in the key name does not behave as expected when installing and checking for dependencies, so quote this string instead.

---
 pythondeps.toml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pythondeps.toml +1 -1
index 9a096160e62..85220a36426 100644
@@ -32,5 +32,5 @@ sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" }
 sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 
 [testdeps]
-qemu.qmp = { accepted = ">=0.0.3", installed = "0.0.3" }
+"qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }
 pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
Signature · 1 line
2.53.0
author
#4 lore raw

PATCH v7 4/19 python/mkvenv: add 'tooling' and 'functests' dependency groups

In reply to John Snow

'tooling' contains depedencies required to run various tools (like qmp-shell) as well as dependencies required to run "make check", and as such, we promise that these dependencies can be sourced from the user's distribution repository or from vendored packages so that "make check" can be executed offline in an isolated build environment.

In contrast, pygdbmi is only needed for functional tests and not tests in general; we do not make the same offline/isolated guarantees for functional tests, and this dependency group is allowed to fetch dependencies from PyPI at runtime.

For the time being, amend the "check-venv" target to install both dependency groups, to avoid a duplicate dependency between them. By the end of this series, however, "check-venv" will be eliminated in favor of always installing "tooling" at configure time and allowing "functests" to be installed on-demand as needed by meson/ninja.

---
 pythondeps.toml        | 10 +++++++++-
 tests/Makefile.include |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)
pythondeps.toml +9 -1
index 85220a36426..743e2a8848c 100644
@@ -31,6 +31,14 @@ meson = { accepted = ">=1.10.0", installed = "1.10.0", canary = "meson" }
 sphinx = { accepted = ">=3.4.3", installed = "6.2.1", canary = "sphinx-build" }
 sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 
-[testdeps]
+# This test group is for dependencies required to run various tooling
+# and tests that should always be installed at configure time. It should
+# only include dependencies that can be guaranteed via configure from
+# system packages, or python packages we vendor.
+[tooling]
 "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }
+
+# This test group is for functional tests, and can include dependencies
+# fetched from PyPI.
+[functests]
 pygdbmi = { accepted = ">=0.11.0.0", installed = "0.11.0.0" }
tests/Makefile.include +1 -1
index be3b78fdfb7..76d77545b71 100644
@@ -108,7 +108,7 @@ quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
 
 $(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml
 	$(call quiet-venv-pip,install -e "$(SRC_PATH)/python/")
-	$(MKVENV_ENSUREGROUP) $< testdeps
+	$(MKVENV_ENSUREGROUP) $< tooling functests
 	$(call quiet-command, touch $@)
 
 check-venv: $(TESTS_VENV_TOKEN)
Signature · 1 line
2.53.0
author
#5 lore raw

PATCH v7 5/19 python/mkvenv: add mechanism to install local package(s)

In reply to John Snow

Currently, we "implicitly" install the local 'qemu' python package for 'make check-venv' with some logic inside tests/Makefile.include. I would like to make this installation explicit in pythondeps.toml instead.

This patch adds a path constraint that can be used in lieu of version constraints to specify that a package should be installed from the source tree instead of from PyPI or vendored packages. This is done to allow us to install the python packages hosted inside of the tree while also processing dependencies; i.e. so that our "qemu" package can specify that it needs "qemu.qmp", which soon will not be included in qemu.git.

This also has the benefit of being able to specify in a declarative configuration file that our pyvenv environment *will* have our local python packages installed and available without any PYTHONPATH hacks, which should simplify iotests, device-crash-test and functional tests without needing to manage local inclusion paths in environment variables.

On the downsides, installing packages through mkvenv/ensuregroup means that there are extra steps we need to take in order to install a local package *offline*; namely we must disable build isolation (so we have access to setuptools) and we must also include python3-wheel in QEMU's build dependencies in order for "make check" to run successfully when in an offline, isolated environment. These extra dependencies are handled in a forthcoming commit; for now, nothing is utilizing this new pathway.

---
 python/scripts/mkvenv.py | 37 +++++++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)
python/scripts/mkvenv.py +31 -6
index b4662d33e6e..8ed6a354505 100644
@@ -662,6 +662,7 @@ def pip_install(
     args: Sequence[str],
     online: bool = False,
     wheels_dir: Optional[Union[str, Path]] = None,
+    env: Optional[Dict[str, str]] = None,
 ) -> None:
     """
     Use pip to install a package or package(s) as specified in @args.
@@ -687,6 +688,7 @@ def pip_install(
     full_args += list(args)
     subprocess.run(
         full_args,
+        env=env,
         check=True,
     )
 
@@ -733,9 +735,14 @@ def _do_ensure(
     :param wheels_dir: If specified, search this path for packages.
     """
     absent = []
+    local_packages = []
     present = []
     canary = None
     for name, info in group.items():
+        if "path" in info:
+            pkgpath = Path(__file__).parents[2].joinpath(info["path"])
+            local_packages.append(str(pkgpath))
+            continue
         constraint = _make_version_constraint(info, False)
         matcher = Matcher(name + constraint)
         print(f"mkvenv: checking for {matcher}", file=sys.stderr)
@@ -770,15 +777,33 @@ def _do_ensure(
             print(f"mkvenv: installing {', '.join(absent)}", file=sys.stderr)
             try:
                 pip_install(args=absent, online=online, wheels_dir=wheels_dir)
-                return None
+                absent = []
             except subprocess.CalledProcessError:
                 pass
 
-        return diagnose(
-            absent[0],
-            online,
-            wheels_dir,
-            canary,
+        if absent:
+            return diagnose(
+                absent[0],
+                online,
+                wheels_dir,
+                canary,
+            )
+
+    # Handle local packages separately and last so we can use different
+    # installation arguments (-e), and so that any dependencies that may
+    # be covered above will be handled according to the depfile
+    # specifications.
+    if local_packages:
+        print(f"mkvenv: installing {', '.join(local_packages)}",
+              file=sys.stderr)
+        env = dict(os.environ)
+        env['PIP_CONFIG_SETTINGS'] = "editable_mode=compat"
+        pip_install(
+            args=["--no-build-isolation",
+                  "-e"] + local_packages,
+            online=online,
+            wheels_dir=wheels_dir,
+            env=env,
         )
 
     return None
Signature · 1 line
2.53.0
author
#6 lore raw

PATCH v7 6/19 meson, mkvenv: add functests custom target

In reply to John Snow

add the "pyvenv_functests_group" target to meson. This target will invoke mkvenv.py to install the associated dependency group to the build/pyvenv directory.

A "pyvenv_tooling_group" is not included here as it is the plan to always install this group by default, so it will not need an on-demand trigger.

---
 meson.build        |  1 +
 pyvenv/meson.build | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 pyvenv/meson.build
meson.build +1 -0
index 4af32c3e1f2..1a3684f36e9 100644
@@ -4564,6 +4564,7 @@ subdir('scripts')
 subdir('tools')
 subdir('pc-bios')
 subdir('docs')
+subdir('pyvenv')
 # Tests are disabled on emscripten because they rely on host features that aren't
 # supported by emscripten (e.g. fork and unix socket).
 if host_os != 'emscripten'
pyvenv/meson.build new file +27 -0
new file mode 100644
index 00000000000..4e7d8d9fcc4
@@ -0,0 +1,27 @@
+# Note that this file only controls "optional" dependency groups; groups
+# unconditionally installed at configure time are handled in configure
+# instead; namely: meson, sphinx, and the tooling groups.
+
+# Note that this command may or may not include the "--online" flag
+# based on configuration.
+ensuregroup_cmd = config_host['MKVENV_ENSUREGROUP'].split()
+
+pyvenv_common_deps = files(
+    meson.project_source_root() + '/pythondeps.toml',
+    meson.project_source_root() + '/python/scripts/mkvenv.py'
+)
+pyvenv_wheel_dir = meson.project_source_root() + '/python/wheels'
+
+# This group is allowed to (and must) rely on internet to fetch from
+# PyPI. Force the use of the --online flag here.
+pyvenv_functests_group = custom_target(
+    'pyvenv_functests_group',
+    output: 'functests.group',
+    input: pyvenv_common_deps,
+    command: ensuregroup_cmd + [
+        '--online',
+        '--dir', pyvenv_wheel_dir,
+        '@INPUT0@',
+        'functests',
+    ],
+)
Signature · 1 line
2.53.0
author
#7 lore raw

PATCH v7 7/19 tests: Use configured python to run GitLab iotests

In reply to John Snow

use the configured python (and the pyvenv) to run iotests instead of the system default python3 interpreter. Use the new "run" script in the build directory to execute the command inside the meson developer environment, templated in qemu.git/run.in.

---
 .gitlab-ci.d/buildtest.yml | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
.gitlab-ci.d/buildtest.yml +9 -9
index e9b5b05e6e8..4c280dd29bc 100644
@@ -350,15 +350,15 @@ build-tcg-disabled:
     - make -j"$JOBS"
     - make check-unit
     - make check-qapi-schema
-    - cd tests/qemu-iotests/
-    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
-            052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
-            170 171 184 192 194 208 221 226 227 236 253 277 image-fleecing
-    - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
-            124 132 139 142 144 145 151 152 155 157 165 194 196 200 202
-            208 209 216 218 227 234 246 247 248 250 254 255 257 258
-            260 261 262 263 264 270 272 273 277 279 image-fleecing
-    - cd ../..
+    - ./run tests/qemu-iotests/check -raw 001 002 003 004 005 008 009
+            010 011 012 021 025 032 033 048 052 063 077 086 101 104 106
+            113 148 150 151 152 157 159 160 163 170 171 184 192 194 208
+            221 226 227 236 253 277 image-fleecing
+    - ./run tests/qemu-iotests/check -qcow2 028 051 056 057 058 065 068
+            082 085 091 095 096 102 122 124 132 139 142 144 145 151 152
+            155 157 165 194 196 200 202 208 209 216 218 227 234 246 247
+            248 250 254 255 257 258 260 261 262 263 264 270 272 273 277
+            279 image-fleecing
     - make distclean
 
 build-user:
Signature · 1 line
2.53.0
author
#8 lore raw

PATCH v7 8/19 tests: use "run" script to execute device-crash-test

In reply to John Snow

Instead of invoking python from the configure venv manually, instruct developers to use the "run" script instead. Change the test invocation to be a good example going forward.

---
 .gitlab-ci.d/buildtest.yml | 6 +++---
 scripts/device-crash-test  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
.gitlab-ci.d/buildtest.yml +3 -3
index 4c280dd29bc..b2db70ff904 100644
@@ -102,7 +102,7 @@ crash-test-debian:
   script:
     - cd build
     - make NINJA=":" check-venv
-    - pyvenv/bin/python3 scripts/device-crash-test -q --tcg-only ./qemu-system-i386
+    - ./run scripts/device-crash-test -q --tcg-only ./qemu-system-i386
 
 build-system-fedora:
   extends:
@@ -159,8 +159,8 @@ crash-test-fedora:
   script:
     - cd build
     - make NINJA=":" check-venv
-    - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-ppc
-    - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-riscv32
+    - ./run scripts/device-crash-test -q ./qemu-system-ppc
+    - ./run scripts/device-crash-test -q ./qemu-system-riscv32
 
 build-system-centos:
   extends:
scripts/device-crash-test +1 -1
index f97d9909c05..8a91dcaee31 100755
@@ -42,7 +42,7 @@ except ModuleNotFoundError as exc:
     print(f"Module '{exc.name}' not found.")
     print("  Try 'make check-venv' from your build directory,")
     print("  and then one way to run this script is like so:")
-    print(f'  > $builddir/pyvenv/bin/python3 "{path}"')
+    print(f'  > $builddir/run "{path}"')
     sys.exit(1)
 
 logger = logging.getLogger('device-crash-test')
Signature · 1 line
2.53.0
author
#9 lore raw

PATCH v7 9/19 tests/lcitool: update lcitool to latest version

In reply to John Snow

Update to latest lcitool master and refresh tests. Fedora is upgraded to Fedora 43 and Alpine from 3.21 to 3.23 as a result.

This is being done in this series primarily to ensure that MacOS installs python-setuptools, which is now separate from the core python package, and which is needed for this series to work correctly.

---
 .gitlab-ci.d/cirrus/macos-14.vars             |   2 +-
 tests/docker/dockerfiles/alpine.docker        |   4 +-
 tests/docker/dockerfiles/centos9.docker       | 240 ++++++++--------
 .../dockerfiles/fedora-rust-nightly.docker    | 262 +++++++++---------
 .../dockerfiles/fedora-win64-cross.docker     | 162 +++++------
 tests/docker/dockerfiles/fedora.docker        | 262 +++++++++---------
 tests/lcitool/libvirt-ci                      |   2 +-
 tests/lcitool/refresh                         |   8 +-
 8 files changed, 471 insertions(+), 471 deletions(-)
.gitlab-ci.d/cirrus/macos-14.vars +1 -1
index 4701c388e14..def77cfdea5 100644
@@ -11,6 +11,6 @@ MAKE='/opt/homebrew/bin/gmake'
 NINJA='/opt/homebrew/bin/ninja'
 PACKAGING_COMMAND='brew'
 PIP3='/opt/homebrew/bin/pip3'
-PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka coreutils ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd'
+PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka coreutils ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python-setuptools python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd'
 PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli'
 PYTHON='/opt/homebrew/bin/python3'
tests/docker/dockerfiles/alpine.docker +2 -2
index 03dd6851f60..76d8dd8cfc7 100644
@@ -1,10 +1,10 @@
 # THIS FILE WAS AUTO-GENERATED
 #
-#  $ lcitool dockerfile --layers all alpine-321 qemu
+#  $ lcitool dockerfile --layers all alpine-323 qemu
 #
 # https://gitlab.com/libvirt/libvirt-ci
 
-FROM docker.io/library/alpine:3.21
+FROM docker.io/library/alpine:3.23
 
 RUN apk update && \
     apk upgrade && \
tests/docker/dockerfiles/centos9.docker +120 -120

246 lines not on this page · raw message

tests/docker/dockerfiles/fedora-rust-nightly.docker +131 -131

277 lines not on this page · raw message

tests/docker/dockerfiles/fedora-win64-cross.docker +81 -81

183 lines not on this page · raw message

tests/docker/dockerfiles/fedora.docker +131 -131

277 lines not on this page · raw message

tests/lcitool/libvirt-ci +1 -1
index caed407a0f1..514b0cd7f63 160000
@@ -1 +1 @@
-Subproject commit caed407a0f1dfe3a3293a41c378c382deefbac36
+Subproject commit 514b0cd7f6375d0089f96e749079093906c532a8
tests/lcitool/refresh +4 -4
index 01a71929542..8f0aa3fa343 100755
@@ -215,12 +215,12 @@ try:
     #
     # Standard native builds
     #
-    generate_dockerfile("alpine", "alpine-321",
+    generate_dockerfile("alpine", "alpine-323",
                         trailer="".join(alpine_extras))
     generate_dockerfile("centos9", "centos-stream-9")
     generate_dockerfile("debian", "debian-13",
                         trailer="".join(debian13_extras))
-    generate_dockerfile("fedora", "fedora-41")
+    generate_dockerfile("fedora", "fedora-43")
     generate_dockerfile("opensuse-leap", "opensuse-leap-15")
     generate_dockerfile("ubuntu2204", "ubuntu-2204",
                         trailer="".join(ubuntu2204_rust_extras),
@@ -230,7 +230,7 @@ try:
     #
     # Non-fatal Rust-enabled build
     #
-    generate_dockerfile("fedora-rust-nightly", "fedora-41",
+    generate_dockerfile("fedora-rust-nightly", "fedora-43",
                         trailer="".join(fedora_rustup_nightly_extras))
 
     #
@@ -287,7 +287,7 @@ try:
                         trailer=cross_build("s390x-linux-gnu-",
                                             "s390x-softmmu,s390x-linux-user"))
 
-    generate_dockerfile("fedora-win64-cross", "fedora-41",
+    generate_dockerfile("fedora-win64-cross", "fedora-43",
                         project='qemu,qemu-win-installer',
                         cross="mingw64",
                         trailer=cross_build("x86_64-w64-mingw32-",
Signature · 1 line
2.53.0
Reviewed-by on v7 9/19
#10 lore raw

Re: [PATCH v7 09/19] tests/lcitool: update lcitool to latest version

Quoted 8 lines · John Snow

Update to latest lcitool master and refresh tests. Fedora is upgraded to Fedora 43 and Alpine from 3.21 to 3.23 as a result.

This is being done in this series primarily to ensure that MacOS installs python-setuptools, which is now separate from the core python package, and which is needed for this series to work correctly.

Quoted 10 lines
---
  .gitlab-ci.d/cirrus/macos-14.vars             |   2 +-
  tests/docker/dockerfiles/alpine.docker        |   4 +-
  tests/docker/dockerfiles/centos9.docker       | 240 ++++++++--------
  .../dockerfiles/fedora-rust-nightly.docker    | 262 +++++++++---------
  .../dockerfiles/fedora-win64-cross.docker     | 162 +++++------
  tests/docker/dockerfiles/fedora.docker        | 262 +++++++++---------
  tests/lcitool/libvirt-ci                      |   2 +-
  tests/lcitool/refresh                         |   8 +-
  8 files changed, 471 insertions(+), 471 deletions(-)
author
#11 lore raw

PATCH v7 10/19 tests/lcitool: add python3 wheel and setuptools deps for qemu

In reply to John Snow

Installing local dependencies while offline, without PyPI access, requires the python3-setuptools and python3-wheel packages. Most distributions have these available anyway for one reason or another, but not all of them.

If you are asking yourself "Wait, aren't these packages guaranteed via installation of pip, via the ensurepip module, which mkvenv takes immense pains to provide for us?" - Well... since Python 3.13, "pip" does not actually come with "setuptools" or "wheel" anymore, and so if we want to build and install a python package, we actually need these available in the host environment.

(Note that you don't need these packages just to install a pre-built package, you only need them to *build* a package. With cutting edge setuptools and pip, all locally installed packages, even in editable mode, must be "built" first before being installed. Thus, these dependencies are being added specifically to facilitate installing qemu.git/python/qemu to the configure-time venv.)

---
 .gitlab-ci.d/cirrus/freebsd-14.vars           | 2 +-
 .gitlab-ci.d/windows.yml                      | 2 ++
 tests/docker/dockerfiles/alpine.docker        | 2 ++
 tests/docker/dockerfiles/centos9.docker       | 2 ++
 tests/docker/dockerfiles/opensuse-leap.docker | 1 +
 tests/lcitool/mappings.yml                    | 2 +-
 tests/lcitool/projects/qemu.yml               | 2 ++
 tests/vm/generated/freebsd.json               | 2 ++
 tests/vm/openbsd                              | 3 +++
 9 files changed, 16 insertions(+), 2 deletions(-)
.gitlab-ci.d/cirrus/freebsd-14.vars +1 -1
index 6477440ef30..98fbde6cc64 100644
@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake'
 NINJA='/usr/local/bin/ninja'
 PACKAGING_COMMAND='pkg'
 PIP3='/usr/local/bin/pip'
-PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache4 cmocka coreutils ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk-vnc gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson mtools ncurses nettle ninja opencv pixman pkgconf png py311-numpy py311-pillow py311-pip py311-pyyaml py311-sphinx py311-sphinx_rtd_theme py311-tomli python3 rpm2cpio rust rust-bindgen-cli sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 vulkan-tools xorriso zstd'
+PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache4 cmocka coreutils ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk-vnc gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson mtools ncurses nettle ninja opencv pixman pkgconf png py311-numpy py311-pillow py311-pip py311-pyyaml py311-setuptools py311-sphinx py311-sphinx_rtd_theme py311-tomli py311-wheel python3 rpm2cpio rust rust-bindgen-cli sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 vulkan-tools xorriso zstd'
 PYPI_PKGS=''
 PYTHON='/usr/local/bin/python3'
.gitlab-ci.d/windows.yml +2 -0
index 5ef4d34d1ea..145500ae464 100644
@@ -89,6 +89,8 @@ msys2-64bit:
       mingw-w64-x86_64-pkgconf
       mingw-w64-x86_64-python
       mingw-w64-x86_64-python-certifi
+      mingw-w64-x86_64-python-setuptools
+      mingw-w64-x86_64-python-wheel
       mingw-w64-x86_64-rust
       mingw-w64-x86_64-rust-bindgen
       mingw-w64-x86_64-zstd"
tests/docker/dockerfiles/alpine.docker +2 -0
index 76d8dd8cfc7..c0303feb48a 100644
@@ -87,8 +87,10 @@ RUN apk update && \
         py3-numpy \
         py3-pillow \
         py3-pip \
+        py3-setuptools \
         py3-sphinx \
         py3-sphinx_rtd_theme \
+        py3-wheel \
         py3-yaml \
         python3 \
         rpm2cpio \
tests/docker/dockerfiles/centos9.docker +2 -0
index 90ac1f7fade..6b1aa6dc0de 100644
@@ -101,9 +101,11 @@ RUN dnf --quiet distro-sync -y && \
                 python3-numpy \
                 python3-pillow \
                 python3-pip \
+                python3-setuptools \
                 python3-sphinx \
                 python3-sphinx_rtd_theme \
                 python3-tomli \
+                python3-wheel \
                 rdma-core-devel \
                 rust \
                 rust-std-static \
tests/docker/dockerfiles/opensuse-leap.docker +1 -0
index a041d439768..d693f2c6f85 100644
@@ -98,6 +98,7 @@ RUN zypper update -y && \
            python311-base \
            python311-pip \
            python311-setuptools \
+           python311-wheel \
            rdma-core-devel \
            rust \
            rust-bindgen \
tests/lcitool/mappings.yml +1 -1
index a749cf8c515..60618971584 100644
@@ -66,7 +66,7 @@ mappings:
     OpenSUSELeap15: python311-base
 
   python3-wheel:
-    OpenSUSELeap15: python311-pip
+    OpenSUSELeap15: python311-wheel
 
   rust:
     Debian12: rustc-web
tests/lcitool/projects/qemu.yml +2 -0
index 1ee7dcf3d46..5e34e953514 100644
@@ -98,11 +98,13 @@ packages:
  - python3-pillow
  - python3-pip
  - python3-PyYAML
+ - python3-setuptools
  - python3-sphinx
  - python3-sphinx-rtd-theme
  - python3-sqlite3
  - python3-tomli
  - python3-venv
+ - python3-wheel
  - rpm2cpio
  - rust
  - rust-std
tests/vm/generated/freebsd.json +2 -0
index f586827b136..08b6eb61553 100644
@@ -57,9 +57,11 @@
     "py311-pillow",
     "py311-pip",
     "py311-pyyaml",
+    "py311-setuptools",
     "py311-sphinx",
     "py311-sphinx_rtd_theme",
     "py311-tomli",
+    "py311-wheel",
     "python3",
     "rpm2cpio",
     "rust",
tests/vm/openbsd +3 -0
index 2ea86a01bad..5222041b855 100755
@@ -60,6 +60,9 @@ class OpenBSDVM(basevm.BaseVM):
 
         # libs: networking
         "libslirp",
+
+        # Python stuff
+        "py3-setuptools",
     ]
 
     BUILD_SCRIPT = """
Signature · 1 line
2.53.0
Reviewed-by on v7 10/19
#12 lore raw

Re: [PATCH v7 10/19] tests/lcitool: add python3 wheel and setuptools deps for qemu

Quoted 20 lines · John Snow

Installing local dependencies while offline, without PyPI access, requires the python3-setuptools and python3-wheel packages. Most distributions have these available anyway for one reason or another, but not all of them.

If you are asking yourself "Wait, aren't these packages guaranteed via installation of pip, via the ensurepip module, which mkvenv takes immense pains to provide for us?" - Well... since Python 3.13, "pip" does not actually come with "setuptools" or "wheel" anymore, and so if we want to build and install a python package, we actually need these available in the host environment.

(Note that you don't need these packages just to install a pre-built package, you only need them to *build* a package. With cutting edge setuptools and pip, all locally installed packages, even in editable mode, must be "built" first before being installed. Thus, these dependencies are being added specifically to facilitate installing qemu.git/python/qemu to the configure-time venv.)

Quoted 11 lines
---
  .gitlab-ci.d/cirrus/freebsd-14.vars           | 2 +-
  .gitlab-ci.d/windows.yml                      | 2 ++
  tests/docker/dockerfiles/alpine.docker        | 2 ++
  tests/docker/dockerfiles/centos9.docker       | 2 ++
  tests/docker/dockerfiles/opensuse-leap.docker | 1 +
  tests/lcitool/mappings.yml                    | 2 +-
  tests/lcitool/projects/qemu.yml               | 2 ++
  tests/vm/generated/freebsd.json               | 2 ++
  tests/vm/openbsd                              | 3 +++
  9 files changed, 16 insertions(+), 2 deletions(-)
author
#13 lore raw

PATCH v7 11/19 python: add vendored qemu.qmp package

In reply to John Snow

In anticipation of deleting the python/qemu/qmp source from the tree, add a vendored version of the qemu.qmp package to ensure that "make check" can be run in isolated build environments, offline.

---
 python/scripts/vendor.py                      |   2 ++
 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl | Bin 0 -> 72263 bytes
 2 files changed, 2 insertions(+)
 create mode 100644 python/wheels/qemu_qmp-0.0.5-py3-none-any.whl
python/scripts/vendor.py +2 -0
index 33b9b0b92b7..46ce2980d5d 100755
@@ -43,6 +43,8 @@ def main() -> int:
     packages = {
         "meson==1.10.0":
         "4b27aafce281e652dcb437b28007457411245d975c48b5db3a797d3e93ae1585",
+        "qemu.qmp==0.0.5":
+        "e05782d6df5844b34e0d2f7c68693525da074deef7b641c1401dda6e4e3d6303",
     }
 
     vendor_dir = Path(__file__, "..", "..", "wheels").resolve()
python/wheels/qemu_qmp-0.0.5-py3-none-any.whl new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..6372b7544ffb015a5c77d9686e921b65c848d433
GIT binary patch
Signature · 1 line
2.53.0
author
#14 lore raw

PATCH v7 12/19 meson, mkvenv: make functional tests depend on functests group

In reply to John Snow

Note that only the thorough group requires the extra testing dependencies; the quick group will run with just the "tooling" group, which we intend to install by default at configure time in a forthcoming commit.

---
 tests/functional/meson.build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/functional/meson.build +4 -1
index 725630d3082..e1f5c0e7678 100644
@@ -57,6 +57,8 @@ foreach speed : ['quick', 'thorough']
       continue
     endif
 
+    test_deps = [roms, keymap_targets]
+
     if speed == 'quick'
       suites = ['func-quick', 'func-' + target_base]
       target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_quick', []) \
@@ -64,9 +66,9 @@ foreach speed : ['quick', 'thorough']
     else
       suites = ['func-' + speed, 'func-' + target_base + '-' + speed, speed]
       target_tests = get_variable('tests_' + target_base + '_' + sysmode + '_' + speed, [])
+      test_deps += [pyvenv_functests_group]
     endif
 
-    test_deps = [roms, keymap_targets]
     test_env = environment()
     if have_tools
       test_env.set('QEMU_TEST_QEMU_IMG', meson.global_build_root() / 'qemu-img')
@@ -99,6 +101,7 @@ foreach speed : ['quick', 'thorough']
       precache = custom_target('func-precache-' + testname,
                                output: teststamp,
                                command: [python, testpath],
+                               depends: pyvenv_functests_group,
                                depend_files: files(testpath),
                                build_by_default: false,
                                env: test_precache_env)
Signature · 1 line
2.53.0
author
#15 lore raw

PATCH v7 13/19 meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml

In reply to John Snow

Add the local python package group into pythondeps.toml for the tooling This makes qemu.qmp, qemu.machine and qemu.utils packages unconditionally available for tests and scripts.

---
 pythondeps.toml | 1 +
 1 file changed, 1 insertion(+)
pythondeps.toml +1 -0
index 743e2a8848c..89256132fee 100644
@@ -37,6 +37,7 @@ sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 # system packages, or python packages we vendor.
 [tooling]
 "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }
+"qemu" = { path = "python/" }
 
 # This test group is for functional tests, and can include dependencies
 # fetched from PyPI.
Signature · 1 line
2.53.0
Reviewed-by on v7 13/19
#16 lore raw

Re: [PATCH v7 13/19] meson, mkvenv: add qemu.git/python/qemu package to pythondeps.toml

Quoted 14 lines · John Snow

Add the local python package group into pythondeps.toml for the tooling This makes qemu.qmp, qemu.machine and qemu.utils packages unconditionally available for tests and scripts.

---
  pythondeps.toml | 1 +
  1 file changed, 1 insertion(+)
pythondeps.toml +0 -0
index 743e2a8848c..89256132fee 100644

pythondeps.toml sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" } · line 43

Quoted 7 lines
pythondeps.toml +1 -0
@@ -37,6 +37,7 @@ sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
  # system packages, or python packages we vendor.
  [tooling]
  "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }
+"qemu" = { path = "python/" }
 
  # This test group is for functional tests, and can include dependencies
  # fetched from PyPI.
author
#17 lore raw

PATCH v7 14/19 configure: unconditionally install "tooling" group

In reply to John Snow

Alongside meson, always ensure our in-tree tooling group and its out-of-tree dependency, qemu.qmp, is always installed.

As a result, several "check-venv" invocations can be removed from various testing scripts.

---
 configure                  | 2 +-
 .gitlab-ci.d/buildtest.yml | 2 --
 scripts/device-crash-test  | 3 +--
 3 files changed, 2 insertions(+), 5 deletions(-)
configure +1 -1
index 4b61fd3bbf8..c4837eba2b1 100755
@@ -966,7 +966,7 @@ mkvenv="$python ${source_path}/python/scripts/mkvenv.py"
 # Finish preparing the virtual environment using vendored .whl files
 
 $mkvenv ensuregroup --dir "${source_path}/python/wheels" \
-     ${source_path}/pythondeps.toml meson || exit 1
+     ${source_path}/pythondeps.toml meson tooling || exit 1
 
 # At this point, we expect Meson to be installed and available.
 # We expect mkvenv or pip to have created pyvenv/bin/meson for us.
.gitlab-ci.d/buildtest.yml +0 -2
index b2db70ff904..1b656b9eb08 100644
@@ -101,7 +101,6 @@ crash-test-debian:
     IMAGE: debian
   script:
     - cd build
-    - make NINJA=":" check-venv
     - ./run scripts/device-crash-test -q --tcg-only ./qemu-system-i386
 
 build-system-fedora:
@@ -158,7 +157,6 @@ crash-test-fedora:
     IMAGE: fedora
   script:
     - cd build
-    - make NINJA=":" check-venv
     - ./run scripts/device-crash-test -q ./qemu-system-ppc
     - ./run scripts/device-crash-test -q ./qemu-system-riscv32
 
scripts/device-crash-test +1 -2
index 8a91dcaee31..fc86babdf43 100755
@@ -40,8 +40,7 @@ try:
 except ModuleNotFoundError as exc:
     path = Path(__file__).resolve()
     print(f"Module '{exc.name}' not found.")
-    print("  Try 'make check-venv' from your build directory,")
-    print("  and then one way to run this script is like so:")
+    print("  Try running this script like so:")
     print(f'  > $builddir/run "{path}"')
     sys.exit(1)
 
Signature · 1 line
2.53.0
author
#18 lore raw

PATCH v7 15/19 tests: replace check-venv with vm-venv target

In reply to John Snow

With the qemu.qmp and qemu.machine dependencies now installed by default at configure time and additional dependencies required by functional testing installed on demand, we do not need the explicit "check-venv" target.

...However, to facilitate running VM tests without running configure, we move some of the former logic into tests/vm/Makefile.include to create a new venv (vm-venv) on-demand when running VM tests from the source tree.

---
 tests/Makefile.include    | 22 ++--------------------
 tests/vm/Makefile.include | 18 ++++++++++++++----
 2 files changed, 16 insertions(+), 24 deletions(-)
tests/Makefile.include +2 -20
index 76d77545b71..59b9a4b9220 100644
@@ -22,7 +22,6 @@ ifneq ($(filter $(all-check-targets), check-softfloat),)
 endif
 	@echo
 	@echo " $(MAKE) check-report.junit.xml        Generates an aggregated XML test report"
-	@echo " $(MAKE) check-venv                    Creates a Python venv for tests"
 	@echo " $(MAKE) check-clean                   Clean the tests and related data"
 	@echo
 	@echo "The following are useful for CI builds"
@@ -93,33 +92,16 @@ clean-tcg: $(CLEAN_TCG_TARGET_RULES)
 .PHONY: distclean-tcg
 distclean-tcg: $(DISTCLEAN_TCG_TARGET_RULES)
 
-# Python venv for running tests
-
-.PHONY: check-venv
-
 # Build up our target list from the filtered list of ninja targets
 TARGETS=$(patsubst libqemu-%.a, %, $(filter libqemu-%.a, $(ninja-targets)))
 
-TESTS_VENV_TOKEN=$(BUILD_DIR)/pyvenv/tests.group
-
-quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
-    $(PYTHON) -m pip -q --disable-pip-version-check $1, \
-    "VENVPIP","$1")
-
-$(TESTS_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml
-	$(call quiet-venv-pip,install -e "$(SRC_PATH)/python/")
-	$(MKVENV_ENSUREGROUP) $< tooling functests
-	$(call quiet-command, touch $@)
-
-check-venv: $(TESTS_VENV_TOKEN)
-
 FUNCTIONAL_TARGETS=$(patsubst %-softmmu,check-functional-%, $(filter %-softmmu,$(TARGETS)))
 .PHONY: $(FUNCTIONAL_TARGETS)
-$(FUNCTIONAL_TARGETS): check-venv
+$(FUNCTIONAL_TARGETS):
 	@$(MAKE) SPEED=thorough $(subst -functional,-func,$@)
 
 .PHONY: check-functional
-check-functional: check-venv
+check-functional:
 	@$(NINJA) precache-functional
 	@$(PYTHON) $(SRC_PATH)/scripts/clean_functional_cache.py
 	@QEMU_TEST_NO_DOWNLOAD=1 $(MAKE) SPEED=thorough check-func check-func-quick
tests/vm/Makefile.include +14 -4
index 14188bba1c6..217bc706c20 100644
@@ -2,13 +2,23 @@
 
 # Hack to allow running in an unconfigured build tree
 ifeq ($(realpath $(SRC_PATH)),$(realpath .))
-VM_PYTHON = PYTHONPATH=$(SRC_PATH)/python /usr/bin/env python3
-VM_VENV =
+VM_PYTHON = $(SRC_PATH)/vm-venv/bin/python3
+VM_VENV = vm-venv
 else
 VM_PYTHON = $(PYTHON)
-VM_VENV = check-venv
+VM_VENV =
 endif
 
+VM_VENV_TOKEN=$(SRC_PATH)/vm-venv/tooling.group $(SRC_PATH)/vm-venv/functests.group
+
+$(VM_VENV_TOKEN): $(SRC_PATH)/pythondeps.toml
+		/usr/bin/env python3 $(SRC_PATH)/python/scripts/mkvenv.py create vm-venv
+		$(SRC_PATH)/vm-venv/bin/python3 $(SRC_PATH)/python/scripts/mkvenv.py ensuregroup --online $(SRC_PATH)/pythondeps.toml tooling functests
+
+.PHONY: vm-venv
+vm-venv: $(VM_VENV_TOKEN)
+# end hackery
+
 .PHONY: vm-build-all vm-clean-all
 
 EFI_AARCH64 = $(wildcard $(BUILD_DIR)/pc-bios/edk2-aarch64-code.fd)
@@ -102,7 +112,7 @@ $(IMAGES_DIR)/%.img:	$(SRC_PATH)/tests/vm/% \
 		$(if $(LOG_CONSOLE),--log-console) \
 		--source-path $(SRC_PATH) \
 		--image "$@" \
-		$(if $(filter-out check-venv, $?), --force) \
+		--force \
 		--build-image $@, \
 		"  VM-IMAGE $*")
 
Signature · 1 line
2.53.0
Tested-by on v7 15/19
#19 lore raw

Re: [PATCH v7 15/19] tests: replace check-venv with vm-venv target

Quoted 8 lines · John Snow

With the qemu.qmp and qemu.machine dependencies now installed by default at configure time and additional dependencies required by functional testing installed on demand, we do not need the explicit "check-venv" target.

...However, to facilitate running VM tests without running configure, we move some of the former logic into tests/vm/Makefile.include to create a new venv (vm-venv) on-demand when running VM tests from the source tree.

Quoted 5 lines
---
  tests/Makefile.include    | 22 ++--------------------
  tests/vm/Makefile.include | 18 ++++++++++++++----
  2 files changed, 16 insertions(+), 24 deletions(-)

Maybe consider adding "vm-venv" to the .gitignore file now?

Anyway,

author
#20 lore raw

Re: [PATCH v7 15/19] tests: replace check-venv with vm-venv target

Quoted 10 lines · Thomas Huth
Quoted 8 lines · John Snow

With the qemu.qmp and qemu.machine dependencies now installed by default at configure time and additional dependencies required by functional testing installed on demand, we do not need the explicit "check-venv" target.

...However, to facilitate running VM tests without running configure, we move some of the former logic into tests/vm/Makefile.include to create a new venv (vm-venv) on-demand when running VM tests from the source tree.

Quoted 7 lines
Quoted 5 lines
---
  tests/Makefile.include    | 22 ++--------------------
  tests/vm/Makefile.include | 18 ++++++++++++++----
  2 files changed, 16 insertions(+), 24 deletions(-)

Maybe consider adding "vm-venv" to the .gitignore file now?

I wasn't sure. Leaving it un-ignored at least calls attention to it if you want to delete it. Can you run "make clean" on a bare repo you haven't run configure on? If so, I could have make clean delete that venv and then also add it to the ignore files.

I could also just instantiate the venv in ~/.cache/qemu/vm-venv alongside the other VM temporary files.... thoughts?

Quoted 4 lines

Anyway,

author
#21 lore raw

PATCH v7 16/19 scripts: nudge users to use 'run' script for scripts that import qemu.qmp

In reply to John Snow

Now that qmp has to be installed and isn't local, we can no longer offer a simple forwarder for these scripts (nor path hacks) and hope that it works. Encourage users to use the 'run' script to use these scripts instead.

---
 scripts/compare-machine-types.py           |  7 ++-----
 scripts/qmp/qemu-ga-client                 | 13 ++++++-------
 scripts/qmp/qmp-shell                      | 13 ++++++-------
 scripts/qmp/qmp-shell-wrap                 | 13 ++++++-------
 scripts/qmp/qom-fuse                       | 13 ++++++-------
 scripts/qmp/qom-get                        | 13 ++++++-------
 scripts/qmp/qom-list                       | 13 ++++++-------
 scripts/qmp/qom-set                        | 13 ++++++-------
 scripts/qmp/qom-tree                       | 13 ++++++-------
 scripts/qmp_helper.py                      |  9 ++-------
 scripts/render_block_graph.py              | 10 +++++++---
 scripts/simplebench/bench_block_job.py     | 10 +++++++---
 tests/migration-stress/guestperf/engine.py | 15 ++++++++++++---
 13 files changed, 78 insertions(+), 77 deletions(-)
scripts/compare-machine-types.py +2 -5
index b4f899082a7..83be361f4f6 100755
@@ -27,19 +27,16 @@
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 import sys
-from os import path
 from argparse import ArgumentParser, RawTextHelpFormatter, Namespace
 import pandas as pd
 from contextlib import ExitStack
 from typing import Optional, List, Dict, Generator, Tuple, Union, Any, Set
 
 try:
-    qemu_dir = path.abspath(path.dirname(path.dirname(__file__)))
-    sys.path.append(path.join(qemu_dir, 'python'))
     from qemu.machine import QEMUMachine
 except ModuleNotFoundError as exc:
-    print(f"Module '{exc.name}' not found.")
-    print("Try export PYTHONPATH=top-qemu-dir/python or run from top-qemu-dir")
+    print(f"Module '{exc.name}' not found.", file=sys.stderr)
+    print(f"Try $builddir/run {' '.join(sys.argv)}", file=sys.stderr)
     sys.exit(1)
 
 
scripts/qmp/qemu-ga-client +6 -7
index 56edd0234a6..7ea01b9a11d 100755
@@ -1,11 +1,10 @@
 #!/usr/bin/env python3
 
-import os
 import sys
 
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.utils import qemu_ga_client
-
-
-if __name__ == '__main__':
-    sys.exit(qemu_ga_client.main())
+print(
+    "This script has moved; after running configure,"
+    " please use '$builddir/run qemu-ga-client [...]' instead.",
+    file=sys.stderr
+)
+sys.exit(1)
scripts/qmp/qmp-shell +6 -7
index 4a20f97db70..436c4940c26 100755
@@ -1,11 +1,10 @@
 #!/usr/bin/env python3
 
-import os
 import sys
 
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.qmp import qmp_shell
-
-
-if __name__ == '__main__':
-    qmp_shell.main()
+print(
+    "This script has moved; after running configure,"
+    " please use '$builddir/run qmp-shell [...]' instead.",
+    file=sys.stderr
+)
+sys.exit(1)
scripts/qmp/qmp-shell-wrap +6 -7
index 9e94da114f5..f63dadad1ed 100755
@@ -1,11 +1,10 @@
 #!/usr/bin/env python3
 
-import os
 import sys
 
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.qmp import qmp_shell
-
-
-if __name__ == '__main__':
-    qmp_shell.main_wrap()
+print(
+    "This script has moved; after running configure,"
+    " please use '$builddir/run qmp-shell-wrap [...]' instead.",
+    file=sys.stderr
+)
+sys.exit(1)
scripts/qmp/qom-fuse +6 -7
index d453807b273..7d4724a3710 100755
@@ -1,11 +1,10 @@
 #!/usr/bin/env python3
 
-import os
 import sys
 
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.utils.qom_fuse import QOMFuse
-
-
-if __name__ == '__main__':
-    sys.exit(QOMFuse.entry_point())
+print(
+    "This script has moved; after running configure,"
+    " please use '$builddir/run qom-fuse [...]' instead.",
+    file=sys.stderr
+)
+sys.exit(1)
scripts/qmp/qom-get +6 -7
index 04ebe052e82..96363539624 100755
@@ -1,11 +1,10 @@
 #!/usr/bin/env python3
 
-import os
 import sys
 
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.utils.qom import QOMGet
-
-
-if __name__ == '__main__':
-    sys.exit(QOMGet.entry_point())
+print(
+    "This script has moved; after running configure,"
+    " please use '$builddir/run qom-get [...]' instead.",
+    file=sys.stderr
+)
+sys.exit(1)
scripts/qmp/qom-list +6 -7
index 853b85a8d3f..e988274d1e7 100755
@@ -1,11 +1,10 @@
 #!/usr/bin/env python3
 
-import os
 import sys
 
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.utils.qom import QOMList
-
-
-if __name__ == '__main__':
-    sys.exit(QOMList.entry_point())
+print(
+    "This script has moved; after running configure,"
+    " please use '$builddir/run qom-list [...]' instead.",
+    file=sys.stderr
+)
+sys.exit(1)
scripts/qmp/qom-set +6 -7
index 06820feec42..c2569afdcd7 100755
@@ -1,11 +1,10 @@
 #!/usr/bin/env python3
 
-import os
 import sys
 
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.utils.qom import QOMSet
-
-
-if __name__ == '__main__':
-    sys.exit(QOMSet.entry_point())
+print(
+    "This script has moved; after running configure,"
+    " please use '$builddir/run qom-set [...]' instead.",
+    file=sys.stderr
+)
+sys.exit(1)
scripts/qmp/qom-tree +6 -7
index 760e172277e..b3cd5ab6f82 100755
@@ -1,11 +1,10 @@
 #!/usr/bin/env python3
 
-import os
 import sys
 
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.utils.qom import QOMTree
-
-
-if __name__ == '__main__':
-    sys.exit(QOMTree.entry_point())
+print(
+    "This script has moved; after running configure,"
+    " please use '$builddir/run qom-tree [...]' instead.",
+    file=sys.stderr
+)
+sys.exit(1)
scripts/qmp_helper.py +2 -7
index c1e7e0fd80c..521612fb946 100755
@@ -13,17 +13,12 @@
 import sys
 
 from datetime import datetime
-from os import path as os_path
 
 try:
-    qemu_dir = os_path.abspath(os_path.dirname(os_path.dirname(__file__)))
-    sys.path.append(os_path.join(qemu_dir, 'python'))
-
     from qemu.qmp.legacy import QEMUMonitorProtocol
-
 except ModuleNotFoundError as exc:
-    print(f"Module '{exc.name}' not found.")
-    print("Try export PYTHONPATH=top-qemu-dir/python or run from top-qemu-dir")
+    print(f"Module '{exc.name}' not found.", file=sys.stderr)
+    print(f"Try $builddir/run {' '.join(sys.argv)}", file=sys.stderr)
     sys.exit(1)
 
 from base64 import b64encode
scripts/render_block_graph.py +7 -3
index 3e1a2e3fa71..b9079bbed52 100755
@@ -24,9 +24,13 @@
 import json
 from graphviz import Digraph
 
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
-from qemu.qmp import QMPError
-from qemu.qmp.legacy import QEMUMonitorProtocol
+try:
+    from qemu.qmp import QMPError
+    from qemu.qmp.legacy import QEMUMonitorProtocol
+except ModuleNotFoundError as exc:
+    print(f"Module '{exc.name}' not found.", file=sys.stderr)
+    print(f"Try $builddir/run {' '.join(sys.argv)}", file=sys.stderr)
+    sys.exit(1)
 
 
 def perm(arr):
scripts/simplebench/bench_block_job.py +7 -3
index e575a3af10e..541a47e586d 100755
@@ -25,9 +25,13 @@
 import socket
 import json
 
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
-from qemu.machine import QEMUMachine
-from qemu.qmp import ConnectError
+try:
+    from qemu.machine import QEMUMachine
+    from qemu.qmp import ConnectError
+except ModuleNotFoundError as exc:
+    print(f"Module '{exc.name}' not found.", file=sys.stderr)
+    print(f"Try $builddir/run {' '.join(sys.argv)}", file=sys.stderr)
+    sys.exit(1)
 
 
 def bench_block_job(cmd, cmd_args, qemu_args):
tests/migration-stress/guestperf/engine.py +12 -3
index d8462db7653..8d2ed757af3 100644
@@ -27,9 +27,18 @@
 from guestperf.report import Report, ReportResult
 from guestperf.timings import TimingRecord, Timings
 
-sys.path.append(os.path.join(os.path.dirname(__file__),
-                             '..', '..', '..', 'python'))
-from qemu.machine import QEMUMachine
+try:
+    from qemu.machine import QEMUMachine
+except ModuleNotFoundError as exc:
+    print(
+        f"Module '{exc.name}' not found.\n"
+        "It should be installed as part of the configure-time "
+        "virtual environment in $builddir/pyvenv.\n"
+        "Try re-running this script as:\n"
+        f"> $builddir/run {' '.join(sys.argv)}",
+        file=sys.stderr
+    )
+    sys.exit(1)
 
 # multifd supported compression algorithms
 MULTIFD_CMP_ALGS = ("zlib", "zstd", "qpl", "uadk")
Signature · 1 line
2.53.0
author
#22 lore raw

PATCH v7 17/19 python: delete qemu.qmp

In reply to John Snow

Start relying on the external python-qemu-qmp dependency instead, to prevent desync between the internal and external libraries.

This library is now entirely independent; to contribute changes, see
https://gitlab.com/qemu-project/python-qemu-qmp/

---
 python/qemu/qmp/__init__.py   |   60 --
 python/qemu/qmp/error.py      |   53 --
 python/qemu/qmp/events.py     |  751 ----------------------
 python/qemu/qmp/legacy.py     |  339 ----------
 python/qemu/qmp/message.py    |  217 -------
 python/qemu/qmp/models.py     |  146 -----
 python/qemu/qmp/protocol.py   | 1101 ---------------------------------
 python/qemu/qmp/py.typed      |    0
 python/qemu/qmp/qmp_client.py |  732 ----------------------
 python/qemu/qmp/qmp_shell.py  |  689 ---------------------
 python/qemu/qmp/qmp_tui.py    |  665 --------------------
 python/qemu/qmp/util.py       |  150 -----
 python/qemu/utils/qom_fuse.py |    1 -
 python/setup.cfg              |   31 +-
 python/tests/minreqs.txt      |    8 +-
 python/tests/protocol.py      |  596 ------------------
 16 files changed, 6 insertions(+), 5533 deletions(-)
 delete mode 100644 python/qemu/qmp/__init__.py
 delete mode 100644 python/qemu/qmp/error.py
 delete mode 100644 python/qemu/qmp/events.py
 delete mode 100644 python/qemu/qmp/legacy.py
 delete mode 100644 python/qemu/qmp/message.py
 delete mode 100644 python/qemu/qmp/models.py
 delete mode 100644 python/qemu/qmp/protocol.py
 delete mode 100644 python/qemu/qmp/py.typed
 delete mode 100644 python/qemu/qmp/qmp_client.py
 delete mode 100644 python/qemu/qmp/qmp_shell.py
 delete mode 100644 python/qemu/qmp/qmp_tui.py
 delete mode 100644 python/qemu/qmp/util.py
 delete mode 100644 python/tests/protocol.py
python/qemu/qmp/__init__.py deleted +0 -60
deleted file mode 100644
index 058139dc3ca..00000000000
@@ -1,60 +0,0 @@
-"""
-QEMU Monitor Protocol (QMP) development library & tooling.
-
-This package provides a fairly low-level class for communicating
-asynchronously with QMP protocol servers, as implemented by QEMU, the
-QEMU Guest Agent, and the QEMU Storage Daemon.
-
-`QMPClient` provides the main functionality of this package. All errors
-raised by this library derive from `QMPError`, see `qmp.error` for
-additional detail. See `qmp.events` for an in-depth tutorial on
-managing QMP events.
-"""
-
-# Copyright (C) 2020-2022 John Snow for Red Hat, Inc.
-#
-# Authors:
-#  John Snow <[email protected]>
-#
-# Based on earlier work by Luiz Capitulino <[email protected]>.
-#
-# This work is licensed under the terms of the GNU LGPL, version 2 or
-# later. See the COPYING file in the top-level directory.
-
-import logging
-
-from .error import QMPError
-from .events import EventListener
-from .message import Message
-from .protocol import (
-    ConnectError,
-    Runstate,
-    SocketAddrT,
-    StateError,
-)
-from .qmp_client import ExecInterruptedError, ExecuteError, QMPClient
-
-
-# Suppress logging unless an application engages it.
-logging.getLogger('qemu.qmp').addHandler(logging.NullHandler())
-
-
-# IMPORTANT: When modifying this list, update the Sphinx overview docs.
-# Anything visible in the qemu.qmp namespace should be on the overview page.
-__all__ = (
-    # Classes, most to least important
-    'QMPClient',
-    'Message',
-    'EventListener',
-    'Runstate',
-
-    # Exceptions, most generic to most explicit
-    'QMPError',
-    'StateError',
-    'ConnectError',
-    'ExecuteError',
-    'ExecInterruptedError',
-
-    # Type aliases
-    'SocketAddrT',
-)
python/qemu/qmp/error.py deleted +0 -53

53 lines not on this page · raw message

python/qemu/qmp/events.py deleted +0 -751

751 lines not on this page · raw message

python/qemu/qmp/legacy.py deleted +0 -339

339 lines not on this page · raw message

python/qemu/qmp/message.py deleted +0 -217

217 lines not on this page · raw message

python/qemu/qmp/models.py deleted +0 -146

146 lines not on this page · raw message

python/qemu/qmp/protocol.py deleted +0 -1101

1,101 lines not on this page · raw message

python/qemu/qmp/py.typed deleted +0 -0
deleted file mode 100644
index e69de29bb2d..00000000000
python/qemu/qmp/qmp_client.py deleted +0 -732

333 lines not on this page · raw message

python/qemu/qmp/qmp_shell.py deleted +0 -689

689 lines not on this page · raw message

python/qemu/qmp/qmp_tui.py deleted +0 -665

665 lines not on this page · raw message

python/qemu/qmp/util.py deleted +0 -150

150 lines not on this page · raw message

python/qemu/utils/qom_fuse.py +0 -1
index cf7e344bd53..e377ef6942f 100644

Lines of this file are not shown. View the raw message.

python/setup.cfg +3 -28
index f40f11396c9..c46a95f8d41 100644

Lines of this file are not shown. View the raw message.

python/tests/minreqs.txt +3 -5
index cd2e2a81c3d..855b5129c94 100644

Lines of this file are not shown. View the raw message.

python/tests/protocol.py deleted +0 -596

596 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.53.0

Part of the diff is not shown here. View the raw message.

author
#23 lore raw

PATCH v7 18/19 python: update README.rst to reflect qemu.qmp's removal

In reply to John Snow

It is no longer simply possible to just use this directory as if it were an installed package now that it has dependencies, so update the README to reflect this.

---
 python/README.rst | 52 ++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 45 insertions(+), 7 deletions(-)
python/README.rst +45 -7
index d62e71528d2..ec5cb5e971b 100644
@@ -3,7 +3,17 @@ QEMU Python Tooling
 
 This directory houses Python tooling used by the QEMU project to build,
 configure, and test QEMU. It is organized by namespace (``qemu``), and
-then by package (e.g. ``qemu/machine``, ``qemu/qmp``, etc).
+then by package (e.g. ``qemu/machine``, ``qemu/utils``, etc).
+
+These tools and libraries are installed to the QEMU configure-time
+Python virtual environment by default (see qemu.git/pythondeps.toml
+"tooling" group), and are available for use by any Python script
+executed by the build system. To have these libraries available for
+manual invocations of scripts, use of the "run" script in your build
+directory is recommended.
+
+General structure
+-----------------
 
 ``setup.py`` is used by ``pip`` to install this tooling to the current
 environment. ``setup.cfg`` provides the packaging configuration used by
@@ -20,9 +30,9 @@ environment. ``setup.cfg`` provides the packaging configuration used by
 
 If you append the ``--editable`` or ``-e`` argument to either invocation
 above, pip will install in "editable" mode. This installs the package as
-a forwarder ("qemu.egg-link") that points to the source tree. In so
-doing, the installed package always reflects the latest version in your
-source tree.
+a forwarder that points to the source tree. In so doing, the installed
+package always reflects the latest version in your source tree. This is
+the mode used to install these packages at configure time.
 
 Installing ".[devel]" instead of "." will additionally pull in required
 packages for testing this package. They are not runtime requirements,
@@ -40,8 +50,18 @@ for more information.
 Using these packages without installing them
 --------------------------------------------
 
-These packages may be used without installing them first, by using one
-of two tricks:
+It is no longer recommended to try to use these packages without
+installing them to a virtual environment, but depending on your use
+case, it may still be possible to do.
+
+The "qemu.qmp" library is now hosted outside of the qemu.git repository,
+and the "qemu.machine" library that remains in-tree here has qemu.qmp as
+a dependency. It is possible to install "qemu.qmp" independently and
+then use the rest of these packages without installing them, but be
+advised that if future dependencies are introduced, bypassing the
+installation phase may introduce breakages to your script in the future.
+
+That said, you can use these packages without installing them by either:
 
 1. Set your PYTHONPATH environment variable to include this source
    directory, e.g. ``~/src/qemu/python``. See
@@ -61,8 +81,26 @@ invoke them without installation, you can invoke e.g.:
 
 ``> PYTHONPATH=~/src/qemu/python python3 -m qemu.qmp.qmp_shell``
 
+**It is strongly advised to just use the configure-time venv instead.**
+After running configure, simply use the run script available in the QEMU
+build directory:
+
+``> $builddir/run qmp-shell``
+
 The mappings between console script name and python module path can be
-found in ``setup.cfg``.
+found in ``setup.cfg``, but the console scripts available are listed
+here for reference:
+
+* ``qemu-ga-client``
+* ``qmp-shell``
+* ``qmp-shell-wrap``
+* ``qmp-tui`` (prototype urwid interface for async QMP)
+* ``qom``
+* ``qom-fuse`` (requires fusepy to be installed!)
+* ``qom-get``
+* ``qom-list``
+* ``qom-set``
+* ``qom-tree``
 
 
 Files in this directory
Signature · 1 line
2.53.0
author
#24 lore raw

PATCH v7 19/19 python: add setuptools and wheel dependencies

In reply to John Snow

Add setuptools and wheel packages to ease installation burden when internet access is allowed. When internet access is not allowed, this functions as a configure-time check ensuring that our environment has the necessary minimum viable versions for these packaging tools available.

For detailed information on Python ecosystem versions, please see
https://gitlab.com/jsnow/repology-dashboard#results-overview-as-of-2026-02-16

---
 pythondeps.toml | 8 ++++++++
 1 file changed, 8 insertions(+)
pythondeps.toml +8 -0
index 89256132fee..a0717742423 100644
@@ -38,6 +38,14 @@ sphinx_rtd_theme = { accepted = ">=0.5", installed = "1.2.2" }
 [tooling]
 "qemu.qmp" = { accepted = ">=0.0.5", installed = "0.0.5" }
 "qemu" = { path = "python/" }
+# NB: The following dependencies should be a little bit more modern than
+# the versions listed here, but we are still using Debian 11 for several
+# GitLab CI tests, so we are further restricted.
+"setuptools" = { accepted = ">=44.1.1" }
+"wheel" = { accepted = ">=0.34.2" }
+# pip should be guaranteed by mkvenv, this is merely a sanity check for
+# which version we are counting on being present.
+"pip" = { accepted = ">=20.3.4" }
 
 # This test group is for functional tests, and can include dependencies
 # fetched from PyPI.
Signature · 1 line
2.53.0
Reviewed-by on v7 19/19
#25 lore raw

Re: [PATCH v7 19/19] python: add setuptools and wheel dependencies

Quoted 6 lines · John Snow

Add setuptools and wheel packages to ease installation burden when internet access is allowed. When internet access is not allowed, this functions as a configure-time check ensuring that our environment has the necessary minimum viable versions for these packaging tools available.

Quoted 8 lines

For detailed information on Python ecosystem versions, please see
https://gitlab.com/jsnow/repology-dashboard#results-overview-as-of-2026-02-16

---
  pythondeps.toml | 8 ++++++++
  1 file changed, 8 insertions(+)