Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libdnf5 plugins written in Python are broken #1775

Open
m-blaha opened this issue Oct 15, 2024 · 0 comments
Open

libdnf5 plugins written in Python are broken #1775

m-blaha opened this issue Oct 15, 2024 · 0 comments

Comments

@m-blaha
Copy link
Member

m-blaha commented Oct 15, 2024

The usage of Python libdnf5 plugins isn't very clear and is poorly documented, so there's a chance I may have made a mistake. Here’s what I tried to write a plugin in Python:

  1. created /etc/dnf/libdnf5-plugins/python_plugins_loader.conf config file with this content to enable python_plugins_loader:
[main]
name = python_plugins_loader
enabled = 1
  1. copied libdnf5-plugins/python_plugins_loader/plugin.py to a temporary directory
  2. set environment variable LIBDNF_PYTHON_PLUGIN_DIR to this directory and tried to run dnf5:
❯ LIBDNF_PYTHON_PLUGIN_DIR=/home/mblaha/temp/xxx dnf5 repoquery acpi
Cannot load plugin "/etc/dnf/libdnf5-plugins/python_plugins_loader.conf": Cannot load plugin "/home/mblaha/temp/xxx/plugin.py": PyObject_CallObject(plugin_class_constructor, nullptr): TypeError("IPlugin.__init__() missing 1 required positional argument: 'data'")
Cannot load plugins: python_plugins_loader.conf

(to get a better error message I also needed to hack libdnf5::Plugins::load_plugins() method to not only log the plugin loading failure, but also print it to console. The thing is that the error occurs during base.setup() call, before the log file is created).

I think that the problem is somehow connected with the change introduced by commit 60338b9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant