Skip to contentSkip to conversation

python: mkvenv: fix messages printed by mkvenv

PATCH In review Paolo Bonzini 3 participants 3 messages Aug 22, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 python: mkvenv: fix messages printed by mkvenv

The new Matcher class does not have a __str__ implementation, and therefore it prints the debugging representation of the internal object:

  $ ../configure --enable-rust && make qemu-system-arm --enable-download
  python determined to be '/usr/bin/python3'
  python version: Python 3.13.6
  mkvenv: Creating non-isolated virtual environment at 'pyvenv'
  mkvenv: checking for LegacyMatcher('meson>=1.5.0')
  mkvenv: checking for LegacyMatcher('pycotap>=1.1.0')

Add the method to print the nicer

mkvenv: checking for meson>=1.5.0
mkvenv: checking for pycotap>=1.1.0

---
 python/scripts/mkvenv.py | 4 ++++
 1 file changed, 4 insertions(+)
python/scripts/mkvenv.py +4 -0
index f102527c4de..9aed266df1b 100644
@@ -184,6 +184,10 @@ def match(self, version_str: str) -> bool:
             )
         )
 
+    def __str__(self) -> str:
+        """String representation delegated to the backend."""
+        return str(self._m)
+
     def __repr__(self) -> str:
         """Stable debug representation delegated to the backend."""
         return repr(self._m)
Signature · 1 line
2.50.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Paolo Bonzini

The new Matcher class does not have a __str__ implementation, and therefore it prints the debugging representation of the internal object:

  $ ../configure --enable-rust && make qemu-system-arm --enable-download
  python determined to be '/usr/bin/python3'
  python version: Python 3.13.6
  mkvenv: Creating non-isolated virtual environment at 'pyvenv'
  mkvenv: checking for LegacyMatcher('meson>=1.5.0')
  mkvenv: checking for LegacyMatcher('pycotap>=1.1.0')

Add the method to print the nicer

Quoted 7 lines

mkvenv: checking for meson>=1.5.0
mkvenv: checking for pycotap>=1.1.0

---

Quoted 22 lines
 python/scripts/mkvenv.py | 4 ++++
 1 file changed, 4 insertions(+)
python/scripts/mkvenv.py +4 -1
index f102527c4de..9aed266df1b 100644
@@ -184,6 +184,10 @@ def match(self, version_str: str) -> bool:
             )
         )
 
+    def __str__(self) -> str:
+        """String representation delegated to the backend."""
+        return str(self._m)
+
     def __repr__(self) -> str:
         """Stable debug representation delegated to the backend."""
         return repr(self._m)
--

2.50.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Paolo Bonzini
Quoted 15 lines · Paolo Bonzini

The new Matcher class does not have a __str__ implementation, and therefore it prints the debugging representation of the internal object:

   $ ../configure --enable-rust && make qemu-system-arm --enable-download
   python determined to be '/usr/bin/python3'
   python version: Python 3.13.6
   mkvenv: Creating non-isolated virtual environment at 'pyvenv'
   mkvenv: checking for LegacyMatcher('meson>=1.5.0')
   mkvenv: checking for LegacyMatcher('pycotap>=1.1.0')

Add the method to print the nicer

mkvenv: checking for meson>=1.5.0
mkvenv: checking for pycotap>=1.1.0

Quoted 6 lines
---
  python/scripts/mkvenv.py | 4 ++++
  1 file changed, 4 insertions(+)