Hello!
I'm trying to use apt_pkg to get a "best candidate" for a package, but with slightly different constraints than I have set up in /etc/apt/preferences.d. I am trying to use Policy.create_pin to do so, but cannot seem to get it working: import apt_pkg apt_pkg.init() cache = apt_pkg.Cache(progress=None) policy = apt_pkg.Policy(cache) #policy.create_pin('origin', '', 'Debian', -1) policy.create_pin('origin', 'apt', 'Debian', -1) policy.init_defaults() print([ (v, policy.get_priority(v)) for v in cache['apt'].version_list ]) All calls to get_priority return 500---not -1, as I am trying to get here. I must be doing something silly. I'd appreciate any help. Best, Antonio