Merge lp:~gz/bzr-builddeb/trivial_apt_pkg_compat_tweak into lp:bzr-builddeb

Proposed by Martin Packman
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 636
Merged at revision: 636
Proposed branch: lp:~gz/bzr-builddeb/trivial_apt_pkg_compat_tweak
Merge into: lp:bzr-builddeb
Diff against target: 15 lines (+2/-2)
1 file modified
directory.py (+2/-2)
To merge this branch: bzr merge lp:~gz/bzr-builddeb/trivial_apt_pkg_compat_tweak
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+80032@code.launchpad.net

Description of the change

Just tweak the way fallback is done for older apt_pkg versions so a deprecation warning is not triggered by accessing the old (capitalised) names unless the new (lowercase) ones do not exist.

Without this, using `bzr info apt:...` (which is really neat by the way) on squeeze gets me:

.../bzrlib/plugins/builddeb/directory.py:47: DeprecationWarning: Attribute 'Lookup'
of the 'apt_pkg.SourceRecords' object is deprecated, use 'lookup' instead.
  lookup = getattr(sources, 'lookup', getattr(sources, 'Lookup', None))
.../bzrlib/plugins/builddeb/directory.py:49: DeprecationWarning: Attribute 'Record'
of the 'apt_pkg.SourceRecords' object is deprecated, use 'record' instead.
  record = getattr(sources, 'record', getattr(sources, 'Record', None))
Retrieving Vcs locating from python-debian Debian version 0.1.18

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'directory.py'
2--- directory.py 2011-07-22 20:12:14 +0000
3+++ directory.py 2011-10-21 08:57:26 +0000
4@@ -44,9 +44,9 @@
5 sources = apt_pkg.GetPkgSrcRecords()
6
7 urls = {}
8- lookup = getattr(sources, 'lookup', getattr(sources, 'Lookup', None))
9+ lookup = getattr(sources, 'lookup', None) or sources.Lookup
10 while lookup(name):
11- record = getattr(sources, 'record', getattr(sources, 'Record', None))
12+ record = getattr(sources, 'record', None) or sources.Record
13 for l in record.splitlines():
14 if not ": " in l:
15 continue

Subscribers

People subscribed via source and target branches