diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2012-08-14 14:58:25 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2012-08-14 14:58:25 +0200 |
| commit | c1ad8a0fbc0adfebdb847f28da92b3d5a1f90582 (patch) | |
| tree | 80225148a1c1d0d4283fb76e827c6ccc9ca206bf /python/apt_pkgmodule.cc | |
| parent | c736d5c9290a2ffdb8802a4ac62e521cf1218b54 (diff) | |
| parent | dfd6bacface878eecf3fec4876bdae2f0491a646 (diff) | |
| download | python-apt-c1ad8a0fbc0adfebdb847f28da92b3d5a1f90582.tar.gz | |
merged from the debian-sid tree
Diffstat (limited to 'python/apt_pkgmodule.cc')
| -rw-r--r-- | python/apt_pkgmodule.cc | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index e8490b4e..7704aa01 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -25,6 +25,8 @@ #include <apt-pkg/init.h> #include <apt-pkg/pkgsystem.h> #include <apt-pkg/orderlist.h> +#include <apt-pkg/aptconfiguration.h> +#include <apt-pkg/fileutl.h> #include <sys/stat.h> #include <libintl.h> @@ -184,11 +186,11 @@ static const char *parse_src_depends_doc = "only contains those dependencies for the architecture set in the\n" "configuration variable APT::Architecture"; static PyObject *RealParseDepends(PyObject *Self,PyObject *Args, - bool ParseArchFlags, string name, + bool ParseArchFlags, std::string name, bool debStyle=false) { - string Package; - string Version; + std::string Package; + std::string Version; unsigned int Op; bool StripMultiArch=true; @@ -393,6 +395,30 @@ 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. The main architectures\n" + "is the first item in the list.";; +static PyObject *GetArchitectures(PyObject *Self,PyObject *Args) +{ + PyObject *Obj; + if (PyArg_ParseTuple(Args,"",&Obj) == 0) + return 0; + + PyObject *List = PyList_New(0); + std::vector<std::string> arches = APT::Configuration::getArchitectures(); + std::vector<std::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 +565,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" @@ -891,7 +920,7 @@ extern "C" void initapt_pkg() PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_SUGGESTS", MkPyNumber(pkgCache::Dep::Suggests)); PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_RECOMMENDS", - MkPyNumber(pkgCache::Dep::Suggests)); + MkPyNumber(pkgCache::Dep::Recommends)); PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_CONFLICTS", MkPyNumber(pkgCache::Dep::Conflicts)); PyDict_SetItemString(PyDependency_Type.tp_dict, "TYPE_REPLACES", |
