Add support for the python-apt 0.8 API.

Starting with version 0.7.100, python-apt introduced a new API which
replaced several functions which created objects with real classes and
updated a number of method names to be PEP8 compliant.
debian
Adam D. Barratt 14 years ago
parent a81988592a
commit de312e4138

@ -409,9 +409,15 @@ class Britney:
package = None package = None
filename = os.path.join(basedir, "Sources") filename = os.path.join(basedir, "Sources")
self.__log("Loading source packages from %s" % filename) self.__log("Loading source packages from %s" % filename)
try:
Packages = apt_pkg.TagFile(open(filename))
get_field = Packages.section.get
step = Packages.step
except AttributeError, e:
Packages = apt_pkg.ParseTagFile(open(filename)) Packages = apt_pkg.ParseTagFile(open(filename))
get_field = Packages.Section.get get_field = Packages.Section.get
while Packages.Step(): step = Packages.Step
while step():
pkg = get_field('Package') pkg = get_field('Package')
ver = get_field('Version') ver = get_field('Version')
# There may be multiple versions of the source package # There may be multiple versions of the source package
@ -459,9 +465,15 @@ class Britney:
filename = os.path.join(basedir, "Packages_%s" % arch) filename = os.path.join(basedir, "Packages_%s" % arch)
self.__log("Loading binary packages from %s" % filename) self.__log("Loading binary packages from %s" % filename)
try:
Packages = apt_pkg.TagFile(open(filename))
get_field = Packages.section.get
step = Packages.step
except AttributeError, e:
Packages = apt_pkg.ParseTagFile(open(filename)) Packages = apt_pkg.ParseTagFile(open(filename))
get_field = Packages.Section.get get_field = Packages.Section.get
while Packages.Step(): step = Packages.Step
while step():
pkg = get_field('Package') pkg = get_field('Package')
version = get_field('Version') version = get_field('Version')

Loading…
Cancel
Save