From 2021c1b4973c3201b1e4580d00b7351c23a831c4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 30 Jan 2012 15:25:37 +0100 Subject: RED: policy should support verfile --- po/python-apt.pot | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'po/python-apt.pot') diff --git a/po/python-apt.pot b/po/python-apt.pot index f1aecc59..a7cf0a8d 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-12-08 20:01+0100\n" +"POT-Creation-Date: 2012-01-30 15:16+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -410,7 +410,7 @@ msgid "Non-DFSG-compatible Software" msgstr "" #. TRANSLATORS: %s is a country -#: ../aptsources/distro.py:210 ../aptsources/distro.py:438 +#: ../aptsources/distro.py:206 ../aptsources/distro.py:434 #, python-format msgid "Server for %s" msgstr "" @@ -418,35 +418,35 @@ msgstr "" #. More than one server is used. Since we don't handle this case #. in the user interface we set "custom servers" to true and #. append a list of all used servers -#: ../aptsources/distro.py:228 ../aptsources/distro.py:234 -#: ../aptsources/distro.py:250 +#: ../aptsources/distro.py:224 ../aptsources/distro.py:230 +#: ../aptsources/distro.py:246 msgid "Main server" msgstr "" -#: ../aptsources/distro.py:254 +#: ../aptsources/distro.py:250 msgid "Custom servers" msgstr "" -#: ../apt/progress/gtk2.py:261 ../apt/progress/gtk2.py:317 +#: ../apt/progress/gtk2.py:258 ../apt/progress/gtk2.py:314 #, python-format msgid "Downloading file %(current)li of %(total)li with %(speed)s/s" msgstr "" -#: ../apt/progress/gtk2.py:267 ../apt/progress/gtk2.py:323 +#: ../apt/progress/gtk2.py:264 ../apt/progress/gtk2.py:320 #, python-format msgid "Downloading file %(current)li of %(total)li" msgstr "" #. Setup some child widgets -#: ../apt/progress/gtk2.py:343 +#: ../apt/progress/gtk2.py:340 msgid "Details" msgstr "" -#: ../apt/progress/gtk2.py:431 +#: ../apt/progress/gtk2.py:428 msgid "Starting..." msgstr "" -#: ../apt/progress/gtk2.py:437 +#: ../apt/progress/gtk2.py:434 msgid "Complete" msgstr "" @@ -479,18 +479,18 @@ msgstr "" msgid "List of files for '%s' could not be read" msgstr "" -#: ../apt/debfile.py:205 +#: ../apt/debfile.py:202 #, python-format msgid "Dependency is not satisfiable: %s\n" msgstr "" -#: ../apt/debfile.py:226 +#: ../apt/debfile.py:223 #, python-format msgid "Conflicts with the installed package '%s'" msgstr "" #. TRANSLATORS: the first '%s' is the package that breaks, the second the dependency that makes it break, the third the relation (e.g. >=) and the latest the version for the releation -#: ../apt/debfile.py:371 +#: ../apt/debfile.py:364 #, python-format msgid "" "Breaks existing package '%(pkgname)s' dependency %(depname)s " @@ -498,63 +498,63 @@ msgid "" msgstr "" #. 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:387 +#: ../apt/debfile.py:380 #, python-format msgid "" "Breaks existing package '%(pkgname)s' conflict: %(targetpkg)s (%(comptype)s " "%(targetver)s)" msgstr "" -#: ../apt/debfile.py:397 +#: ../apt/debfile.py:390 #, python-format msgid "" "Breaks existing package '%(pkgname)s' that conflict: '%(targetpkg)s'. But " "the '%(debfile)s' provides it via: '%(provides)s'" msgstr "" -#: ../apt/debfile.py:445 +#: ../apt/debfile.py:438 msgid "No Architecture field in the package" msgstr "" -#: ../apt/debfile.py:455 +#: ../apt/debfile.py:448 #, python-format msgid "Wrong architecture '%s'" msgstr "" #. the deb is older than the installed -#: ../apt/debfile.py:462 +#: ../apt/debfile.py:455 msgid "A later version is already installed" msgstr "" -#: ../apt/debfile.py:487 +#: ../apt/debfile.py:480 msgid "Failed to satisfy all dependencies (broken cache)" msgstr "" -#: ../apt/debfile.py:517 +#: ../apt/debfile.py:510 #, python-format msgid "Cannot install '%s'" msgstr "" -#: ../apt/debfile.py:561 +#: ../apt/debfile.py:554 msgid "Python-debian module not available" msgstr "" -#: ../apt/debfile.py:604 +#: ../apt/debfile.py:597 msgid "" "Automatically decompressed:\n" "\n" msgstr "" -#: ../apt/debfile.py:610 +#: ../apt/debfile.py:603 msgid "Automatically converted to printable ascii:\n" msgstr "" -#: ../apt/debfile.py:700 +#: ../apt/debfile.py:693 #, python-format msgid "Install Build-Dependencies for source package '%s' that builds %s\n" msgstr "" -#: ../apt/debfile.py:711 +#: ../apt/debfile.py:704 msgid "An essential package would be removed" msgstr "" -- cgit v1.2.3 From 00ce4d227aef4ccde15f8cfa5b1a5582195eb639 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 30 Jan 2012 15:33:24 +0100 Subject: GREEN: policy should suppors PkgVerFile now --- po/python-apt.pot | 2 +- python/policy.cc | 3 +++ tests/test_policy.py | 13 +++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'po/python-apt.pot') diff --git a/po/python-apt.pot b/po/python-apt.pot index a7cf0a8d..b99c36e1 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-01-30 15:16+0100\n" +"POT-Creation-Date: 2012-01-30 15:32+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/python/policy.cc b/python/policy.cc index b11e4dde..b7e648b5 100644 --- a/python/policy.cc +++ b/python/policy.cc @@ -46,6 +46,9 @@ PyObject *policy_get_priority(PyObject *self, PyObject *arg) { if (PyObject_TypeCheck(arg, &PyPackage_Type)) { pkgCache::PkgIterator pkg = GetCpp(arg); return MkPyNumber(policy->GetPriority(pkg)); + } else if (PyObject_TypeCheck(arg, &PyPackageFile_Type)) { + pkgCache::PkgFileIterator pkgfile = GetCpp(arg); + return MkPyNumber(policy->GetPriority(pkgfile)); } else { PyErr_SetString(PyExc_TypeError,"Argument must be of Package()."); return 0; diff --git a/tests/test_policy.py b/tests/test_policy.py index 2d261f5f..2aab6722 100644 --- a/tests/test_policy.py +++ b/tests/test_policy.py @@ -19,12 +19,13 @@ class TestAptPolicy(unittest.TestCase): # basic tests pkg = cache["apt"] self.assertEqual(policy.get_priority(pkg._pkg), 0) - # get verfile - ver = pkg.candidate._cand - verfile_list = ver.file_list - for verfile in verfile_list: - print verfile - self.assertEqual(policy.get_priority(verfile), 500) + # get priority for all pkgfiles + for ver in pkg.versions: + lowlevel_ver = ver._cand + for pkgfile, i in lowlevel_ver.file_list: + #print verfile, i, policy.get_priority(pkgfile) + self.assertTrue(policy.get_priority(pkgfile) > 1) + self.assertTrue(policy.get_priority(pkgfile) < 1001) if __name__ == "__main__": -- cgit v1.2.3 From 055dc32f4025f081293cee32cde935100532c651 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 30 Jan 2012 15:40:50 +0100 Subject: RED: apt.Version should have "policy_priority" property --- debian/changelog | 1 + po/python-apt.pot | 2 +- tests/test_policy.py | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'po/python-apt.pot') diff --git a/debian/changelog b/debian/changelog index 7f582bff..1e400dfb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ python-apt (0.8.4) UNRELEASED; urgency=low * doc/examples/build-deps.py: - update the build-deps.py example to use the apt API more + * add support for apt_pkg.Policy.get_priority(PkgFileIterator) -- Michael Vogt Wed, 04 Jan 2012 12:07:48 +0100 diff --git a/po/python-apt.pot b/po/python-apt.pot index b99c36e1..58877b55 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-01-30 15:32+0100\n" +"POT-Creation-Date: 2012-01-30 15:40+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/tests/test_policy.py b/tests/test_policy.py index 2aab6722..449c3961 100644 --- a/tests/test_policy.py +++ b/tests/test_policy.py @@ -11,7 +11,7 @@ import unittest class TestAptPolicy(unittest.TestCase): - def test_apt_policy(self): + def test_apt_policy_lowlevel(self): # get a policy cache = apt.Cache() policy = cache._depcache.policy @@ -23,10 +23,16 @@ class TestAptPolicy(unittest.TestCase): for ver in pkg.versions: lowlevel_ver = ver._cand for pkgfile, i in lowlevel_ver.file_list: - #print verfile, i, policy.get_priority(pkgfile) + print pkgfile, i, policy.get_priority(pkgfile) self.assertTrue(policy.get_priority(pkgfile) > 1) self.assertTrue(policy.get_priority(pkgfile) < 1001) + def test_apt_policy_highlevel(self): + cache = apt.Cache() + pkg = cache["apt"] + self.assertTrue(pkg.candidate.policy_priority > 1 and + pkg.candidate.policy_priority < 1001) + if __name__ == "__main__": unittest.main() -- cgit v1.2.3