summaryrefslogtreecommitdiff
path: root/python/apt_pkgmodule.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-10-21 10:08:44 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-10-21 10:08:44 +0200
commitb7ce3c2b47e1234631e00cb0ba8a86fa0aa9c8d8 (patch)
tree583780c6eba172bd247f355f2cccd62092b8e118 /python/apt_pkgmodule.cc
parent8ca5779cfe930f8a423969f7266949ab2826cede (diff)
downloadpython-apt-b7ce3c2b47e1234631e00cb0ba8a86fa0aa9c8d8.tar.gz
* python/apt_pkgmodule.cc:
- add apt_pkg.get_architectures() call
Diffstat (limited to 'python/apt_pkgmodule.cc')
-rw-r--r--python/apt_pkgmodule.cc27
1 files changed, 27 insertions, 0 deletions
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"