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

Determine the default plugin path at configure time, rather than runtime #1782

Merged
merged 1 commit into from
Aug 3, 2021

Conversation

encukou
Copy link
Contributor

@encukou encukou commented Jul 2, 2021

DNF currently gets the default plugin path using sysconfig.get_path().
This function can be used to determine where files should be installed, but it doesn't necessarily tell you where they have been installed.
For DNF specifically, installing system packages (RPMs) might use different locations than packages installed by tools like pip, setuptools and distutils.
DNF works now (we've ben careful not to break it), but there will likely be larger changes in this area (see a discuss.python.org thread). It would be nice to get ready for that ahead of time.

Here is one way to set the default plugin path to the location DNF will install the plugin to, using CMake interpolation.

Another way would be to see where dnf is imported from, and look for dnf-plugins next to that directory.
Yet another would be to treat dnf-plugins as a "normal" package and import it using.e.g. importlib.import_module('dnf-plugins') – but there might be security concerns since the Python package path can be easily changed.

The sysconfig.get_path() function should be used to determine where
files *should* be installed, not necessarily where they *have* been
installed.
For DNF specifically, these locations might differ, since system
packages (RPMs) might use different locations than packages installed
by tools like pip, setuptools and distutils.
@kontura kontura self-assigned this Aug 3, 2021
@kontura
Copy link
Contributor

kontura commented Aug 3, 2021

Thank you.

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

Successfully merging this pull request may close these issues.

None yet

2 participants