Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #243985

python-apt create_pin question

From Antonio Russo <aerusso@aerusso.net>
Newsgroups linux.debian.user
Subject python-apt create_pin question
Date 2022-01-14 16:40 +0100
Message-ID <DFwQi-8v6-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.debian.user | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

python-apt create_pin question Antonio Russo <aerusso@aerusso.net> - 2022-01-14 16:40 +0100
  Re: python-apt create_pin question Andrei POPESCU <andreimpopescu@gmail.com> - 2022-01-15 18:40 +0100
  Re: python-apt create_pin question Michael Lange <klappnase@freenet.de> - 2022-01-17 11:10 +0100
    Re: python-apt create_pin question Antonio Russo <aerusso@aerusso.net> - 2022-01-17 16:20 +0100

csiph-web