qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 6/6] python: add entry point for aqmp-tui


From: John Snow
Subject: Re: [PATCH 6/6] python: add entry point for aqmp-tui
Date: Wed, 7 Jul 2021 22:14:04 -0400



On Fri, Jul 2, 2021 at 5:26 PM G S Niteesh Babu <niteesh.gs@gmail.com> wrote:
Add an entry point for aqmp-tui. This will allow it to be run from
the command line using "aqmp-tui -a localhost:1234"

Signed-off-by: G S Niteesh Babu <niteesh.gs@gmail.com>
---
 python/setup.cfg | 1 +
 1 file changed, 1 insertion(+)

diff --git a/python/setup.cfg b/python/setup.cfg
index 4782fe5241..23e30185f4 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -68,6 +68,7 @@ console_scripts =
     qom-fuse = qemu.qmp.qom_fuse:QOMFuse.entry_point [fuse]
     qemu-ga-client = qemu.qmp.qemu_ga_client:main
     qmp-shell = qemu.qmp.qmp_shell:main
+    aqmp-tui = qemu.aqmp.aqmp_tui:main

I was going to suggest that you could use [tui] at the end here to protect the script from being run when we don't have the optional dependency group installed, but even with it, I get a pretty nasty error:

Traceback (most recent call last):
  File "/home/jsnow/src/qemu/python/.pyvenv/bin/aqmp-tui", line 33, in <module>
    sys.exit(load_entry_point('qemu==0.6.1.0a1', 'console_scripts', 'aqmp-tui')())
  File "/home/jsnow/src/qemu/python/.pyvenv/bin/aqmp-tui", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib64/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/jsnow/src/qemu/python/.pyvenv/lib64/python3.9/site-packages/qemu/aqmp/aqmp_tui.py", line 14, in <module>
    from pygments import lexers
ModuleNotFoundError: No module named 'pygments'

It looks like this feature isn't working for me ... I'm not sure I know why.

In theory it should work: https://setuptools.readthedocs.io/en/latest/userguide/entry_point.html#dependency-management

We might have to make our own custom entry point script that guards this a little bit better if we can't solve this mystery. The goal is either to:

(1) Do not install an aqmp-tui script at all if we don't select the optional TUI group, or
(2) Have the script error out early with a nice error message explaining what optional dependencies it requires.
 

 [flake8]
 extend-ignore = E722  # Prefer pylint's bare-except checks to flake8's
--
2.17.1


reply via email to

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