Bug#680891: python-apt: documentation for apt_pkg.version_compare wrong
On Sun, Jul 08, 2012 at 04:18:51PM -0600, Ansgar Burchardt wrote:
> Package: python-apt
> Version: 0.8.4
> Severity: normal
>
> The documentation for apt_pkg.version_compare states
>
> Compare the given versions; return -1 if 'a' is smaller than 'b',
> 0 if they are equal, and 2 if 'a' is larger than 'b'.
>
> but this is wrong:
>
> apt_pkg.version_compare('3.2.1-11+squeeze6', '3.2.1-11+squeeze1')
> --> 5
Indeed, the documentation is incorrect here. It should says:
"""
"Compare the given versions; return <0 if 'a' is smaller than 'b',\n"
"0 if they are equal, and >0 if 'a' is larger than 'b'.";
"""
Because it reports the first "chunk" difference it can find, e.g.:
>>> apt_pkg.version_compare('7', '1')
>>> 6
I fixed this in my bzr branch.
Cheers,
Michael
> Ansgar
>
> -- System Information:
> Debian Release: wheezy/sid
> APT prefers testing
> APT policy: (900, 'testing'), (500, 'unstable'), (1, 'experimental')
> Architecture: amd64 (x86_64)
>
> Kernel: Linux 3.2.0-2-amd64 (SMP w/2 CPU cores)
> Locale: LANG=C, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
> Shell: /bin/sh linked to /bin/dash
>
> Versions of packages python-apt depends on:
> ii libapt-inst1.5 0.9.6
> ii libapt-pkg4.12 0.9.6
> ii libc6 2.13-33
> ii libgcc1 1:4.7.1-2
> ii libstdc++6 4.7.1-2
> ii python 2.7.3~rc2-1
> ii python-apt-common 0.8.4
> ii python2.6 2.6.8-0.2
> ii python2.7 2.7.3~rc2-2.1
>
> Versions of packages python-apt recommends:
> ii iso-codes 3.36-1
> ii lsb-release 4.1+Debian7
> ii python2.6 2.6.8-0.2
> pn xz-lzma <none>
>
> Versions of packages python-apt suggests:
> pn python-apt-dbg <none>
> pn python-apt-doc <none>
> ii python-gtk2 2.24.0-3
> pn python-vte <none>
>
> -- no debconf information
>
>
>
> --
> To UNSUBSCRIBE, email to deity-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: http://lists.debian.org/20120708221851.24714.98411.reportbug@marvin.43-1.org
>
Reply to: