Bug#543223: how about making Version hashable?

Piotr Ożarowski piotr at debian.org
Sun Aug 23 10:25:20 UTC 2009

Package: python-debian
Version: 0.1.14
Severity: wishlist
Tags: patch

I'm thinking about adding SQLAlchemy bindings to Ultimate Debian
Database and send it to you as debian.udd[1] module. Right now I cannot
use debian_bundle.debian_support.Version as column type as it's not
hashable. Please consider below patch.

[1] I mentioned it to lets-play-without-shoes zack and he told me to
    send a patch to python-debian
    BTW: why aren't you using common namespace for all modules
    python-debian provides? (package name suggests "debian" namespace)

| --- debian_bundle/debian_support.py.orig	2009-08-23 11:44:07.939763837 +0200
| +++ debian_bundle/debian_support.py	2009-08-23 11:44:50.663888415 +0200
| @@ -78,7 +78,10 @@
|          return 'Version(%s)' % `self.__asString`
|      def __cmp__(self, other):
| -        return apt_pkg.VersionCompare(self.__asString, other.__asString)
| +        return apt_pkg.VersionCompare(str(self), str(other))
| +
| +    def __hash__(self):
| +        return hash(str(self))
|  version_compare = apt_pkg.VersionCompare

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=pl_PL.UTF-8, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-debian depends on:
ii  python                        2.5.4-2    An interactive high-level object-o
ii  python-support                1.0.3      automated rebuilding support for P

Versions of packages python-debian recommends:
ii  python-apt             Python interface to libapt-pkg

Versions of packages python-debian suggests:
ii  gpgv                          1.4.9-4    GNU privacy guard - signature veri

-- no debconf information

More information about the pkg-python-debian-maint mailing list