Red Hat Bugzilla – Bug 1022940
_bestPackageFromList doesn't work
Last modified: 2013-10-24 07:16:57 EDT
AttributeError: 'Base' object has no attribute '_compare_providers'
base = dnf.base.Base()
print base._bestPackageFromList([1, 2])
It's related to bug#979353 - we need this functionality, preferably in hawkey, but dnf would be also acceptable.
I'm afraid this is going to be CANTFIX'd. libsolv internally considers "all" providers, and this is burried very deep. This functionality is not needed.
All you can do is searching for all packages providing "foo", and excluding all but the one you want to use. But this has to run *before* depsolving, not in a callback.
It has been explained many times now that the DNF API is not to be used until documentation to it is published. Therefore nothing is supported yet and it is possible things like _bestPackageFromLIst will be dropped entirely. I am afraid we can not help you here, for the reasons mentioned by Zdenek in comment 1. Also, as you mention we are already tracking this in bug 979353.
> print base._bestPackageFromList([1, 2])
And we certainly will not document and support methods starting with an underscore in the API, please see PEP 0008