diff options
| -rw-r--r-- | debian/changelog | 2 | ||||
| -rw-r--r-- | po/python-apt.pot | 20 | ||||
| -rw-r--r-- | python/apt_pkgmodule.cc | 27 | ||||
| -rw-r--r-- | tests/test_apt_cache.py | 5 |
4 files changed, 44 insertions, 10 deletions
diff --git a/debian/changelog b/debian/changelog index 39c506e6..6fbc5241 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,8 @@ python-apt (0.8.2) UNRELEASED; urgency=low - updated, thanks to Joe Dalton (closes: #631309) * po/sr.po: - updated, thanks to Nikola Nenadic (closes: #638308) + * python/apt_pkgmodule.cc: + - add apt_pkg.get_architectures() call [ Tshepang Lekhonkhobe ] * rm usage of camelcase in cache.py doc (closes: #626617) diff --git a/po/python-apt.pot b/po/python-apt.pot index 70c68099..48b4fb18 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-10-19 18:07+0200\n" +"POT-Creation-Date: 2011-10-21 10:05+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -455,11 +455,11 @@ msgstr "" msgid "Invalid unicode in description for '%s' (%s). Please report." msgstr "" -#: ../apt/package.py:1065 ../apt/package.py:1171 +#: ../apt/package.py:1068 ../apt/package.py:1174 msgid "The list of changes is not available" msgstr "" -#: ../apt/package.py:1177 +#: ../apt/package.py:1180 #, python-format msgid "" "The list of changes is not available yet.\n" @@ -468,7 +468,7 @@ msgid "" "until the changes become available or try again later." msgstr "" -#: ../apt/package.py:1184 +#: ../apt/package.py:1187 msgid "" "Failed to download the list of changes. \n" "Please check your Internet connection." @@ -535,26 +535,26 @@ msgstr "" msgid "Cannot install '%s'" msgstr "" -#: ../apt/debfile.py:508 +#: ../apt/debfile.py:510 msgid "Python-debian module not available" msgstr "" -#: ../apt/debfile.py:542 +#: ../apt/debfile.py:544 msgid "" "Automatically decompressed:\n" "\n" msgstr "" -#: ../apt/debfile.py:548 +#: ../apt/debfile.py:550 msgid "Automatically converted to printable ascii:\n" msgstr "" -#: ../apt/debfile.py:638 +#: ../apt/debfile.py:640 #, python-format msgid "Install Build-Dependencies for source package '%s' that builds %s\n" msgstr "" -#: ../apt/debfile.py:648 +#: ../apt/debfile.py:650 msgid "An essential package would be removed" msgstr "" @@ -605,6 +605,6 @@ msgstr "" msgid "Please insert a Disc in the drive and press enter" msgstr "" -#: ../apt/cache.py:149 +#: ../apt/cache.py:148 msgid "Building data structures" msgstr "" diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index e8490b4e..03c88e9a 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -25,6 +25,7 @@ #include <apt-pkg/init.h> #include <apt-pkg/pkgsystem.h> #include <apt-pkg/orderlist.h> +#include <apt-pkg/aptconfiguration.h> #include <sys/stat.h> #include <libintl.h> @@ -393,6 +394,29 @@ static PyObject *sha256sum(PyObject *Self,PyObject *Args) return 0; } /*}}}*/ +// get_architectures - return the list of architectures /*{{{*/ +// --------------------------------------------------------------------- +static const char *doc_GetArchitectures = + "get_architectures() -> list\n\n" + "Return the list of supported architectures on this system. On a \n" + "multiarch system this can be more than one.";; +static PyObject *GetArchitectures(PyObject *Self,PyObject *Args) +{ + PyObject *Obj; + if (PyArg_ParseTuple(Args,"",&Obj) == 0) + return 0; + + PyObject *List = PyList_New(0); + vector<string> arches = APT::Configuration::getArchitectures(); + vector<string>::const_iterator I; + for (I = arches.begin(); I != arches.end(); I++) + { + PyList_Append(List, CppPyString(*I)); + } + + return List; +} + /*}}}*/ // init - 3 init functions /*{{{*/ // --------------------------------------------------------------------- static char *doc_Init = @@ -539,6 +563,9 @@ static PyMethodDef methods[] = {"sha1sum",sha1sum,METH_VARARGS,doc_sha1sum}, {"sha256sum",sha256sum,METH_VARARGS,doc_sha256sum}, + // multiarch + {"get_architectures", GetArchitectures, METH_VARARGS, doc_GetArchitectures}, + // Strings {"check_domain_list",StrCheckDomainList,METH_VARARGS, "check_domain_list(host: str, domains: str) -> bool\n\n" diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index 2b742dfa..0d80f617 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -191,6 +191,11 @@ class TestAptCache(unittest.TestCase): self.assertEqual([p.name for p in l], ["apt", "libc6", "xterm"]) + def test_get_architectures(self): + main_arch = apt.apt_pkg.config.get("APT::Architecture") + arches = apt_pkg.get_architectures() + self.assertTrue(main_arch in arches) + if __name__ == "__main__": unittest.main() |
