diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2012-10-12 11:06:34 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2012-10-12 11:06:34 +0200 |
| commit | cd32418cab838095163688ec25095032daec07e5 (patch) | |
| tree | 1f6f8c74851cf9f0379d252deb55f1d3c6e7ba4c | |
| parent | 78e9e09c400d9ea185da11328a00ef9251c0b342 (diff) | |
| parent | 02820025e1d48f7bde9551aeda6f12784ab0c954 (diff) | |
| download | python-apt-cd32418cab838095163688ec25095032daec07e5.tar.gz | |
merged from the debian-sid branch
| -rw-r--r-- | debian/changelog | 63 | ||||
| -rw-r--r-- | po/da.po | 99 | ||||
| -rw-r--r-- | python/progress.cc | 2 | ||||
| -rw-r--r-- | tests/test_auth.py | 9 | ||||
| -rw-r--r-- | tests/test_lp1030278.py | 22 | ||||
| -rw-r--r-- | tests/test_size_to_str.py | 112 |
6 files changed, 199 insertions, 108 deletions
diff --git a/debian/changelog b/debian/changelog index 203c968d..15b445d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,47 @@ -python-apt (0.8.7ubuntu5) UNRELEASED; urgency=low +python-apt (0.8.8ubuntu1) UNRELEASED; urgency=low + * merged from the debian-sid branch: + - do not build-depend on python-unittest2, only needed for python2.6 * add dep8 style autopkgtest support * add "codename" to the PackageFile object -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 12 Oct 2012 11:02:03 +0200 + +python-apt (0.8.8) unstable; urgency=low + + [ Program translation updates ] + * po/pl.po: Polish (Michał Kułach) (closes: #684308) + * po/da.po: Danish (Joe Hansen) (closes: #689827) + + [ Michael Vogt ] + * merged lp:~sampo555/python-apt/fix_1042916 reuse existing but + disabled sources.list entries instead of duplicating them. + Thanks to "sampo555", LP: #1042916 + * consolidate tests/test_lp1030278.py into the new + tests/test_size_to_str.py + * apt/auth.py: + - support importing long keyids with leading 0x and mixed case + * debian/control: + - build-depend on python-unittest2 to get "with TestCase.assertRaises" + support in python2.6 + + [ Barry Warsaw ] + * python/string.cc, tests/test_lp1030278.py: Fix StrSizeToStr() so that + 1) it first checks for PyLong-ness so that in Python 3 on i386, it + will be able to convert larger numbers (via doubles rather than ints); + 2) before doing the conversions through the apt API, check to see if a + Python exception occurred, e.g. OverflowError, and return an error + condition in that case instead of masking it. (LP: #1030278) + + [ James Hunt ] + * python/cache.cc: PkgCacheGetIsMultiArch(): Return calculated + value rather than a random one. + * lp:~jamesodhunt/python-apt/test-for-size_to_str: + - add test for size_to_str() to help with finding LP: #1030278 + + -- Michael Vogt <mvo@debian.org> Fri, 12 Oct 2012 10:47:11 +0200 + python-apt (0.8.7ubuntu4) quantal; urgency=low * apt/auth.py: @@ -45,30 +82,6 @@ python-apt (0.8.7ubuntu1) quantal; urgency=low -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 01 Oct 2012 13:47:43 +0200 -python-apt (0.8.8) UNRELEASED; urgency=low - - [ Program translation updates ] - * po/pl.po: Polish (Michał Kułach) (closes: #684308) - - [ Michael Vogt ] - * merged lp:~sampo555/python-apt/fix_1042916 reuse existing but - disabled sources.list entries instead of duplicating them. - Thanks to "sampo555", LP: #1042916 - - [ Barry Warsaw ] - * python/string.cc, tests/test_lp1030278.py: Fix StrSizeToStr() so that - 1) it first checks for PyLong-ness so that in Python 3 on i386, it - will be able to convert larger numbers (via doubles rather than ints); - 2) before doing the conversions through the apt API, check to see if a - Python exception occurred, e.g. OverflowError, and return an error - condition in that case instead of masking it. (LP: #1030278) - - [ James Hunt ] - * python/cache.cc: PkgCacheGetIsMultiArch(): Return calculated - value rather than a random one. - - -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 01 Oct 2012 13:30:53 +0200 - python-apt (0.8.7) unstable; urgency=low [ Translation updates ] @@ -1,20 +1,20 @@ # Danish translation python-apt. -# Copyright (C) 2011 python-apt & nedenstående oversætttere. +# Copyright (C) 2012 python-apt & nedenstående oversætttere. # This file is distributed under the same license as the python-apt package. # Mads Bille Lundby <lundbymads@gmail.com>, 2009. # AJenbo <anders@jenbo.dk>, 2011. # Ask, 2011. -# Joe Hansen <joedalton2@yahoo.dk>, 2011. +# Joe Hansen <joedalton2@yahoo.dk>, 2011, 2012. # msgid "" msgstr "" "Project-Id-Version: python-apt\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2012-06-25 14:31+0200\n" -"PO-Revision-Date: 2011-06-22 14:44+0200\n" +"PO-Revision-Date: 2012-10-06 14:44+0200\n" "Last-Translator: Joe Hansen <joedalton2@yahoo.dk>\n" -"Language-Team: Danish <debian-l10n-danish@lists.debian.org> \n" -"Language: \n" +"Language-Team: Danish <debian-l10n-danish@lists.debian.org>\n" +"Language: da\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -27,103 +27,83 @@ msgstr "http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Ubuntu.info.in:151 -#, fuzzy -#| msgid "Ubuntu 7.04 'Feisty Fawn'" msgid "Ubuntu 12.04 'Precise Pangolin'" -msgstr "Ubuntu 7.04 \"Feisty Fawn\"" +msgstr "Ubuntu 12.04 \"Precise Pangolin\"" #. Description #: ../data/templates/Ubuntu.info.in:158 -#, fuzzy -#| msgid "Cdrom with Ubuntu 7.04 'Feisty Fawn'" msgid "Cdrom with Ubuntu 12.04 'Precise Pangolin'" -msgstr "Cd-rom med Ubuntu 7.04 \"Feisty Fawn\"" +msgstr "Cd-rom med Ubuntu 12.04 \"Precise Pangolin\"" #. Description #: ../data/templates/Ubuntu.info.in:269 -#, fuzzy -#| msgid "Ubuntu 9.10 'Karmic Koala'" msgid "Ubuntu 11.10 'Oneiric Ocelot'" -msgstr "Ubuntu 9.10 \"Karmic Koala\"" +msgstr "Ubuntu 11.10 \"Oneiric Ocelot\"" #. Description #: ../data/templates/Ubuntu.info.in:276 -#, fuzzy -#| msgid "Cdrom with Ubuntu 9.10 'Karmic Koala'" msgid "Cdrom with Ubuntu 11.10 'Oneiric Ocelot'" -msgstr "Cd-rom med Ubuntu 9.10 \"Karmic Koala\"" +msgstr "Cd-rom med Ubuntu 11.10 \"Oneiric Ocelot\"" #. Description #: ../data/templates/Ubuntu.info.in:388 -#, fuzzy -#| msgid "Ubuntu 4.10 'Warty Warthog'" msgid "Ubuntu 11.04 'Natty Narwhal'" -msgstr "Ubuntu 4.10 \"Warty Warthog\"" +msgstr "Ubuntu 11.04 \"Natty Narwhal\"" #. Description #: ../data/templates/Ubuntu.info.in:395 -#, fuzzy -#| msgid "Cdrom with Ubuntu 4.10 'Warty Warthog'" msgid "Cdrom with Ubuntu 11.04 'Natty Narwhal'" -msgstr "Cd-rom med Ubuntu 4.10 \"Warty Warthog\"" +msgstr "Cd-rom med Ubuntu 11.04 \"Natty Narwhal\"" #. Description #: ../data/templates/Ubuntu.info.in:486 -#, fuzzy -#| msgid "Ubuntu 9.10 'Karmic Koala'" msgid "Ubuntu 10.10 'Maverick Meerkat'" -msgstr "Ubuntu 9.10 \"Karmic Koala\"" +msgstr "Ubuntu 10.10 \"Maverick Meerkat\"" #. Description #: ../data/templates/Ubuntu.info.in:506 -#, fuzzy -#| msgid "Cdrom with Ubuntu 9.10 'Karmic Koala'" msgid "Cdrom with Ubuntu 10.10 'Maverick Meerkat'" -msgstr "Cd-rom med Ubuntu 9.10 \"Karmic Koala\"" +msgstr "Cd-rom med Ubuntu 10.10 \"Maverick Meerkat\"" #. Description #: ../data/templates/Ubuntu.info.in:518 msgid "Canonical Partners" -msgstr "" +msgstr "Canonicalpartnere" #. CompDescription #: ../data/templates/Ubuntu.info.in:520 msgid "Software packaged by Canonical for their partners" -msgstr "" +msgstr "Programmer pakket af Canonical for deres partnere" #. CompDescriptionLong #: ../data/templates/Ubuntu.info.in:521 msgid "This software is not part of Ubuntu." -msgstr "" +msgstr "Dette program er ikke en del af Ubuntu." #. Description #: ../data/templates/Ubuntu.info.in:528 msgid "Independent" -msgstr "" +msgstr "Uafhængigt" #. CompDescription #: ../data/templates/Ubuntu.info.in:530 msgid "Provided by third-party software developers" -msgstr "" +msgstr "Tilbudt af tredjepartsprogramudviklere" #. CompDescriptionLong #: ../data/templates/Ubuntu.info.in:531 msgid "Software offered by third party developers." -msgstr "" +msgstr "Programmer tilbudt af tredjepartsudviklere." #. Description #: ../data/templates/Ubuntu.info.in:569 -#, fuzzy -#| msgid "Ubuntu 8.04 'Hardy Heron'" msgid "Ubuntu 10.04 'Lucid Lynx'" -msgstr "Ubuntu 8.04 \"Hardy Heron\"" +msgstr "Ubuntu 10.04 \"Lucid Lynx\"" #. Description #: ../data/templates/Ubuntu.info.in:589 -#, fuzzy -#| msgid "Cdrom with Ubuntu 8.04 'Hardy Heron'" msgid "Cdrom with Ubuntu 10.04 'Lucid Lynx'" -msgstr "Cd-rom med Ubuntu 8.04 \"Hardy Heron\"" +msgstr "Cd-rom med Ubuntu 10.04 \"Lucid Lynx\"" #. Description #: ../data/templates/Ubuntu.info.in:632 @@ -212,10 +192,8 @@ msgstr "Ubuntu 6.06 LTS \"Dapper Drake\"" #. CompDescriptionLong #: ../data/templates/Ubuntu.info.in:1075 -#, fuzzy -#| msgid "Canonical-supported Open Source software" msgid "Canonical-supported free and open-source software" -msgstr "Canonical-understøttet software med åben kildekode" +msgstr "Canonical-understøttede frie programmer med åben kildekode" #. CompDescription #: ../data/templates/Ubuntu.info.in:1077 @@ -224,10 +202,8 @@ msgstr "Vedligeholdt af fællesskabet (universe)" #. CompDescriptionLong #: ../data/templates/Ubuntu.info.in:1078 -#, fuzzy -#| msgid "Community-maintained Open Source software" msgid "Community-maintained free and open-source software" -msgstr "Software med åben kildekode vedligeholdt af fællesskabet" +msgstr "Fællesskabsvedligeholdt frie programmer med åben kildekode" #. CompDescription #: ../data/templates/Ubuntu.info.in:1080 @@ -382,10 +358,8 @@ msgstr "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog" #. Description #: ../data/templates/Debian.info.in:8 -#, fuzzy -#| msgid "Debian 6.0 'Squeeze' " msgid "Debian 7.0 'Wheezy' " -msgstr "Debian 6.0 \"Squeeze\" " +msgstr "Debian 7.0 \"Wheezy\" " #. Description #: ../data/templates/Debian.info.in:33 @@ -514,14 +488,12 @@ msgstr "" "Undersøg venligst din internetforbindelse." #: ../apt/debfile.py:82 -#, fuzzy, python-format -#| msgid "List of files for '%s'could not be read" +#, python-format msgid "List of files for '%s' could not be read" msgstr "Listen over filer for \"%s\" kunne ikke læses" #: ../apt/debfile.py:93 -#, fuzzy, python-format -#| msgid "List of files for '%s'could not be read" +#, python-format msgid "List of control files for '%s' could not be read" msgstr "Listen over filer for \"%s\" kunne ikke læses" @@ -542,6 +514,8 @@ msgid "" "Breaks existing package '%(pkgname)s' dependency %(depname)s " "(%(deprelation)s %(depversion)s)" msgstr "" +"Ødelægger eksisterende pakke \"%(pkgname)s\" afhængighed %(depname)s " +"(%(deprelation)s %(depversion)s)" #. TRANSLATORS: the first '%s' is the package that conflicts, the second the packagename that it conflicts with (so the name of the deb the user tries to install), the third is the relation (e.g. >=) and the last is the version for the relation #: ../apt/debfile.py:389 @@ -550,6 +524,8 @@ msgid "" "Breaks existing package '%(pkgname)s' conflict: %(targetpkg)s (%(comptype)s " "%(targetver)s)" msgstr "" +"Ødelægger eksisterende pakke \"%(pkgname)s\" konflikt %(targetpkg)s (%(comptype)s " +"%(targetver)s)" #: ../apt/debfile.py:399 #, python-format @@ -557,10 +533,12 @@ msgid "" "Breaks existing package '%(pkgname)s' that conflict: '%(targetpkg)s'. But " "the '%(debfile)s' provides it via: '%(provides)s'" msgstr "" +"Ødelægger eksisterende pakke \"%(pkgname)s\" som er i konflikt: \"%(targetpkg)s\". " +"Men \"%(debfile)s\" tilbyder den via: \"%(provides)s\"" #: ../apt/debfile.py:447 msgid "No Architecture field in the package" -msgstr "" +msgstr "Intet arkitekturfelt i pakken" #: ../apt/debfile.py:457 #, python-format @@ -586,15 +564,17 @@ msgid "" "Automatically decompressed:\n" "\n" msgstr "" +"Automatisk pakket ud:\n" +"\n" #: ../apt/debfile.py:599 msgid "Automatically converted to printable ascii:\n" -msgstr "" +msgstr "Automatisk konverteret til udskrivbar ascii:\n" #: ../apt/debfile.py:689 #, python-format msgid "Install Build-Dependencies for source package '%s' that builds %s\n" -msgstr "Installér bygge-afhængigheder til kildepakke \"%s\" der bygger %s\n" +msgstr "Installer byggeafhængigheder for kildepakken \"%s\" der bygger %s\n" #: ../apt/debfile.py:700 msgid "An essential package would be removed" @@ -603,7 +583,7 @@ msgstr "En nødvendig pakke vil blive fjernet" #: ../apt/progress/text.py:82 #, python-format msgid "%c%s... Done" -msgstr "%c%s... Færdig" +msgstr "%c%s ... Færdig" #: ../apt/progress/text.py:122 msgid "Hit " @@ -654,5 +634,4 @@ msgstr "Indsæt en disk i drevet og tryk retur" msgid "Building data structures" msgstr "Opbygger datastrukturer" -#~ msgid "This is not a valid DEB archive, missing '%s' member" -#~ msgstr "Dette er ikke et gyldigt DEB-arkiv, mangler \"%s-medlem\"" + diff --git a/python/progress.cc b/python/progress.cc index a7fd7ae1..9e870875 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -28,6 +28,8 @@ inline bool setattr(PyObject *object, const char *attr, const char *fmt, T arg) if (!object) return false; PyObject *value = Py_BuildValue(fmt, arg); + if (value == NULL) + return false; int result = PyObject_SetAttrString(object, attr, value); Py_DECREF(value); diff --git a/tests/test_auth.py b/tests/test_auth.py index d742a471..2b524d28 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -14,6 +14,13 @@ else: from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler as HTTPRequestHandler + +if sys.version_info[0] == 2 and sys.version_info[1] == 6: + from unittest2 import TestCase +else: + from unittest import TestCase + + import apt_pkg import apt.auth @@ -103,7 +110,7 @@ DHcut3Yey8o= -----END PGP PUBLIC KEY BLOCK-----""" -class TestAuthKeys(unittest.TestCase): +class TestAuthKeys(TestCase): """Test handling of keys for signed repositories.""" diff --git a/tests/test_lp1030278.py b/tests/test_lp1030278.py deleted file mode 100644 index 1cbc2c18..00000000 --- a/tests/test_lp1030278.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -"""Regression test for LP: #1030278""" - -__author__ = "Barry Warsaw <barry@ubuntu.com>" - -import unittest -import apt_pkg - - -class RegressionTestCase(unittest.TestCase): - - def test_no_overflow_error(self): - # LP: #1030278 produces an overflow error in size_to_str() with a big - # value under Python 3. - self.assertEqual(apt_pkg.size_to_str(2147483648000000000000), '2147 E') - - -if __name__ == "__main__": - unittest.main() - -# vim: ts=4 et sts=4 diff --git a/tests/test_size_to_str.py b/tests/test_size_to_str.py new file mode 100644 index 00000000..2c2c372f --- /dev/null +++ b/tests/test_size_to_str.py @@ -0,0 +1,112 @@ +#!/usr/bin/python + +__author__ = "Barry Warsaw <barry@ubuntu.com>, James Hunt, Michael Vogt" + +import sys +import unittest + +import apt_pkg + +if sys.version_info[0] == 2 and sys.version_info[1] == 6: + from unittest2 import TestCase +else: + from unittest import TestCase + + +class SizeToStrTestCase(TestCase): + """Test apt_pkg.size_to_str""" + + DATA = { + # XXX: note the trailing spaces for some of these entries! + 10 ** 1 : "10 ", + 10 ** 2 : "100 ", + 10 ** 3 : "1000 ", + 10 ** 4 : "10.0 k", + 10 ** 5 : "100 k", + 10 ** 6 : "1000 k", + 10 ** 7 : "10.0 M", + 10 ** 8 : "100 M", + 10 ** 9 : "1000 M", + 10 ** 10 : "10.0 G", + 10 ** 11 : "100 G", + 10 ** 12 : "1000 G", + 10 ** 13 : "10.0 T", + 10 ** 14 : "100 T", + 10 ** 15 : "1000 T", + 10 ** 16 : "10.0 P", + 10 ** 17 : "100 P", + 10 ** 18 : "1000 P", + 10 ** 19 : "10.0 E", + 10 ** 20 : "100 E", + 10 ** 21 : "1000 E", + 10 ** 22 : "10.0 Z", + 10 ** 23 : "100.0 Z", + 10 ** 24 : "1000 Z", +# 10 ** 25 : "10.0 Y", + 10 ** 26 : "100 Y", + 10 ** 27 : "1000 Y", + + # That's our limit :) + 10 ** 28 : "10000 Y", + + 0 : "0 ", + 1 : "1 ", + 1024 : "1024 ", + 10240 : "10.2 k", + 102400 : "102 k", + 1024000 : "1024 k", + 10240000 : "10.2 M", + 102400000 : "102 M", + 2147483647 : "2147 M", + 2147483648 : "2147 M", + 1024000000 : "1024 M", + 10240000000 : "10.2 G", + + 9 : "9 ", + 99 : "99 ", + 999 : "999 ", + 9999 : "9999 ", + 99999 : "100.0 k", + 999999 : "1000 k", + 9999999 : "10000 k", + 99999999 : "100.0 M", + 999999999 : "1000 M", + 9999999999 : "10000 M", + 99999999999 : "100.0 G", + 999999999999 : "1000 G", + 9999999999999 : "10000 G", + 99999999999999 : "100.0 T", + 999999999999999 : "1000 T", + 9999999999999999 : "10.0 P", + 99999999999999999 : "100 P", + 999999999999999999 : "1000 P", + 9999999999999999999 : "10.0 E", + 99999999999999999999 : "100 E", + 999999999999999999999 : "1000 E", + 9999999999999999999999 : "10.0 Z", + 999999999999999999999999 : "1000 Z", + } + + def test_from_data(self): + for k, v in self.DATA.items(): + size = apt_pkg.size_to_str(k) + msg = "size_to_str(%s) returned '%s', expected '%s'" % (k, size, v) + self.assertEqual(size, v, msg) + + def test_raise_on_unsupported(self): + for v in ["hello", None, {}, [], ()]: + with self.assertRaises(TypeError): + apt_pkg.size_to_str(v) + + +class RegressionTestCase(unittest.TestCase): + """Regression test for LP: #1030278""" + + def test_no_overflow_error(self): + # LP: #1030278 produces an overflow error in size_to_str() with a big + # value under Python 3. + self.assertEqual(apt_pkg.size_to_str(2147483648000000000000), '2147 E') + + +if __name__ == "__main__": + unittest.main() |
