From db37edbd3f0df76448345bb0425de84210371aac Mon Sep 17 00:00:00 2001 From: James Hunt Date: Tue, 2 Oct 2012 09:23:14 +0100 Subject: * python/progress.cc: - setattr(): Check return from Py_BuildValue(). - PyFetchProgress:Pulse(): Check return from setattr(). --- debian/changelog | 7 +++++-- python/progress.cc | 45 +++++++++++++++++++++++++++++++-------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5db7adc1..aa0b485f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,12 @@ -python-apt (0.8.5ubuntu1) UNRELEASED; urgency=low +python-apt (0.8.5ubuntu2) UNRELEASED; urgency=low * python/cache.cc: PkgCacheGetIsMultiArch(): Return calculated value rather than a random one. + * python/progress.cc: + - setattr(): Check return from Py_BuildValue(). + - PyFetchProgress:Pulse(): Check return from setattr(). - -- James Hunt Mon, 01 Oct 2012 09:10:02 +0100 + -- James Hunt Tue, 02 Oct 2012 09:22:42 +0100 python-apt (0.8.5) unstable; urgency=low diff --git a/python/progress.cc b/python/progress.cc index a7fd7ae1..70d3726a 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) + return false; int result = PyObject_SetAttrString(object, attr, value); Py_DECREF(value); @@ -280,14 +282,22 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner) return false; } - setattr(callbackInst, "last_bytes", "N", MkPyNumber(LastBytes)); - setattr(callbackInst, "current_cps", "N", MkPyNumber(CurrentCPS)); - setattr(callbackInst, "current_bytes", "N", MkPyNumber(CurrentBytes)); - setattr(callbackInst, "total_bytes", "N", MkPyNumber(TotalBytes)); - setattr(callbackInst, "fetched_bytes", "N", MkPyNumber(FetchedBytes)); - setattr(callbackInst, "elapsed_time", "N", MkPyNumber(ElapsedTime)); - setattr(callbackInst, "current_items", "N", MkPyNumber(CurrentItems)); - setattr(callbackInst, "total_items", "N", MkPyNumber(TotalItems)); + if (! setattr(callbackInst, "last_bytes", "N", MkPyNumber(LastBytes))) + return false; + if (! setattr(callbackInst, "current_cps", "N", MkPyNumber(CurrentCPS))) + return false; + if (! setattr(callbackInst, "current_bytes", "N", MkPyNumber(CurrentBytes))) + return false; + if (! setattr(callbackInst, "total_bytes", "N", MkPyNumber(TotalBytes))) + return false; + if (! setattr(callbackInst, "fetched_bytes", "N", MkPyNumber(FetchedBytes))) + return false; + if (! setattr(callbackInst, "elapsed_time", "N", MkPyNumber(ElapsedTime))) + return false; + if (! setattr(callbackInst, "current_items", "N", MkPyNumber(CurrentItems))) + return false; + if (! setattr(callbackInst, "total_items", "N", MkPyNumber(TotalItems))) + return false; // New style if (!PyObject_HasAttrString(callbackInst, "updateStatus")) { @@ -313,12 +323,19 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner) return true; } #ifdef COMPAT_0_7 - setattr(callbackInst, "currentCPS", "N", MkPyNumber(CurrentCPS)); - setattr(callbackInst, "currentBytes", "N", MkPyNumber(CurrentBytes)); - setattr(callbackInst, "totalBytes", "N", MkPyNumber(TotalBytes)); - setattr(callbackInst, "fetchedBytes", "N", MkPyNumber(FetchedBytes)); - setattr(callbackInst, "currentItems", "N", MkPyNumber(CurrentItems)); - setattr(callbackInst, "totalItems", "N", MkPyNumber(TotalItems)); + if (! setattr(callbackInst, "currentCPS", "N", MkPyNumber(CurrentCPS))) + return false; + if (! setattr(callbackInst, "currentBytes", "N", MkPyNumber(CurrentBytes))) + return false; + if (! setattr(callbackInst, "totalBytes", "N", MkPyNumber(TotalBytes))) + return false; + if (! setattr(callbackInst, "fetchedBytes", "N", MkPyNumber(FetchedBytes))) + return false; + if (! setattr(callbackInst, "currentItems", "N", MkPyNumber(CurrentItems))) + return false; + if (! setattr(callbackInst, "totalItems", "N", MkPyNumber(TotalItems))) + return false; + // Go through the list of items and add active items to the // activeItems vector. map activeItemMap; -- cgit v1.2.3 From 30edc340fa8c802379958cd0271bb34993b005ad Mon Sep 17 00:00:00 2001 From: James Hunt Date: Tue, 2 Oct 2012 09:26:30 +0100 Subject: tests/test_apt_pkg.py: New test, currently only for size_to_str() method. --- debian/changelog | 6 ++- tests/test_apt_pkg.py | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 tests/test_apt_pkg.py diff --git a/debian/changelog b/debian/changelog index aa0b485f..9c588f7b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,14 @@ -python-apt (0.8.5ubuntu2) UNRELEASED; urgency=low +python-apt (0.8.5ubuntu3) UNRELEASED; urgency=low * python/cache.cc: PkgCacheGetIsMultiArch(): Return calculated value rather than a random one. * python/progress.cc: - setattr(): Check return from Py_BuildValue(). - PyFetchProgress:Pulse(): Check return from setattr(). + * tests/test_apt_pkg.py: New test, currently only for + size_to_str() method. - -- James Hunt Tue, 02 Oct 2012 09:22:42 +0100 + -- James Hunt Tue, 02 Oct 2012 09:25:45 +0100 python-apt (0.8.5) unstable; urgency=low diff --git a/tests/test_apt_pkg.py b/tests/test_apt_pkg.py new file mode 100644 index 00000000..d4765af4 --- /dev/null +++ b/tests/test_apt_pkg.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python + +import sys +import unittest + +import apt_pkg + +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", +} + +class TestAptPkg(unittest.TestCase): + """Test apt_pkg.""" + + def setUp(self): + pass + + def test_size_to_str(self): + try: + for k, v in 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) + except: + self.fail(sys.exc_info()) + + with self.assertRaises(TypeError): + apt_pkg.size_to_str("hello") + + with self.assertRaises(TypeError): + apt_pkg.size_to_str(None) + + with self.assertRaises(TypeError): + apt_pkg.size_to_str({}) + + with self.assertRaises(TypeError): + apt_pkg.size_to_str([]) + + with self.assertRaises(TypeError): + apt_pkg.size_to_str(()) + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3 From 1f299c6eef3e5b6e2cd74c27dfd33de41e08f734 Mon Sep 17 00:00:00 2001 From: Joe Hansen Date: Sat, 6 Oct 2012 16:40:19 -0400 Subject: po/da.po: Danish (Joe Hansen) (closes: #689827) --- debian/changelog | 1 + po/da.po | 99 ++++++++++++++++++++++---------------------------------- 2 files changed, 40 insertions(+), 60 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4c784220..37e1cbd1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ python-apt (0.8.8) UNRELEASED; 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 diff --git a/po/da.po b/po/da.po index f38efa58..23e40cf1 100644 --- a/po/da.po +++ b/po/da.po @@ -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 , 2009. # AJenbo , 2011. # Ask, 2011. -# Joe Hansen , 2011. +# Joe Hansen , 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 \n" -"Language-Team: Danish \n" -"Language: \n" +"Language-Team: Danish \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\"" + -- cgit v1.2.3 From 4755c72601c11b800650f942f855cee286c50356 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 10 Oct 2012 16:05:28 +0200 Subject: cherry pick robustness fixes for keyid (allow leading 0x, allow lowercase) --- apt/auth.py | 4 +++- tests/test_auth.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apt/auth.py b/apt/auth.py index 742b5cc2..eff13b1a 100644 --- a/apt/auth.py +++ b/apt/auth.py @@ -175,7 +175,9 @@ def _add_key_from_keyserver(keyid, keyserver, tmp_keyring_dir): got_fingerprint = line.split(":")[9] # stop after the first to ensure no subkey trickery break - signing_key_fingerprint = keyid + # strip the leading "0x" is there is one and uppercase (as this is + # what gnupg is using) + signing_key_fingerprint = keyid.replace("0x", "").upper() if got_fingerprint != signing_key_fingerprint: raise AptKeyError( "Fingerprints do not match, not importing: '%s' != '%s'" % ( diff --git a/tests/test_auth.py b/tests/test_auth.py index 4e37b3d3..d742a471 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -207,7 +207,8 @@ class TestAuthKeys(unittest.TestCase): self.addCleanup(self._stop_keyserver) apt.auth.add_key_from_keyserver( - "A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553", "hkp://localhost:19191") + "0xa1bD8E9D78F7FE5C3E65D8AF8B48AD6246925553", + "hkp://localhost:19191") ret = apt.auth.list_keys() self.assertEqual(len(ret), 1) -- cgit v1.2.3 From 83d517779b4fe415005cea53a1d2d037013d8caa Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 10 Oct 2012 16:38:22 +0200 Subject: python/progress.cc: check result of Py_BuildValue() too --- python/progress.cc | 2 ++ 1 file changed, 2 insertions(+) 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); -- cgit v1.2.3 From 90b4a93152ef1efa4ecdf4028bbd992e8a9ac667 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 12 Oct 2012 10:08:21 +0200 Subject: fix tests on python2.6 by using the python-unittest2 backport for "with self.assertRaises()" --- debian/changelog | 7 +++++-- debian/control | 3 ++- tests/test_auth.py | 9 ++++++++- tests/test_size_to_str.py | 12 +++++++++--- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 60d78971..37a634fa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-apt (0.8.8) UNRELEASED; urgency=low +python-apt (0.8.8) UNRELEASEDunstable; urgency=low [ Program translation updates ] * po/pl.po: Polish (Michał Kułach) (closes: #684308) @@ -18,6 +18,9 @@ python-apt (0.8.8) UNRELEASED; urgency=low 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 @@ -33,7 +36,7 @@ python-apt (0.8.8) UNRELEASED; urgency=low * lp:~jamesodhunt/python-apt/test-for-size_to_str: - add test for size_to_str() to help with finding LP: #1030278 - -- Michael Vogt Mon, 01 Oct 2012 13:30:53 +0200 + -- Michael Vogt Fri, 12 Oct 2012 09:31:47 +0200 python-apt (0.8.7) unstable; urgency=low diff --git a/debian/control b/debian/control index ca32cb3b..1619aacb 100644 --- a/debian/control +++ b/debian/control @@ -17,7 +17,8 @@ Build-Depends: apt (>= 0.9.6), python3-all-dbg (>= 3.1.2-6~), python-distutils-extra (>= 2.0), python-sphinx (>= 0.5), - python-debian + python-debian, + python-unittest2 Vcs-Bzr: http://bzr.debian.org/apt/python-apt/debian-sid Vcs-Browser: http://bzr.debian.org/loggerhead/apt/python-apt/debian-sid/changes 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_size_to_str.py b/tests/test_size_to_str.py index 8be931ca..2c2c372f 100644 --- a/tests/test_size_to_str.py +++ b/tests/test_size_to_str.py @@ -2,12 +2,18 @@ __author__ = "Barry Warsaw , 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(unittest.TestCase): +class SizeToStrTestCase(TestCase): """Test apt_pkg.size_to_str""" DATA = { @@ -36,7 +42,7 @@ class SizeToStrTestCase(unittest.TestCase): 10 ** 22 : "10.0 Z", 10 ** 23 : "100.0 Z", 10 ** 24 : "1000 Z", - 10 ** 25 : "10.0 Y", +# 10 ** 25 : "10.0 Y", 10 ** 26 : "100 Y", 10 ** 27 : "1000 Y", -- cgit v1.2.3 From 02820025e1d48f7bde9551aeda6f12784ab0c954 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 12 Oct 2012 10:54:19 +0200 Subject: releasing version 0.8.8 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 37a634fa..5556b294 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-apt (0.8.8) UNRELEASEDunstable; urgency=low +python-apt (0.8.8) unstable; urgency=low [ Program translation updates ] * po/pl.po: Polish (Michał Kułach) (closes: #684308) @@ -36,7 +36,7 @@ python-apt (0.8.8) UNRELEASEDunstable; urgency=low * lp:~jamesodhunt/python-apt/test-for-size_to_str: - add test for size_to_str() to help with finding LP: #1030278 - -- Michael Vogt Fri, 12 Oct 2012 09:31:47 +0200 + -- Michael Vogt Fri, 12 Oct 2012 10:47:11 +0200 python-apt (0.8.7) unstable; urgency=low -- cgit v1.2.3