summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2011-04-21 14:21:22 +0200
committerJulian Andres Klode <jak@debian.org>2011-04-21 14:21:22 +0200
commit16166e89fb1d1243ac92017f03d7bdada904cd38 (patch)
tree5ef99504defe264461e617b1ff94a28c4617e790
parent9d00ce840131092e7a7ae26cd0b0279c7646a7a5 (diff)
downloadpython-apt-16166e89fb1d1243ac92017f03d7bdada904cd38.tar.gz
apt_pkg: Add apt_pkg.Version.multi_arch and friends
-rw-r--r--debian/changelog3
-rw-r--r--doc/source/library/apt_pkg.rst43
-rw-r--r--python/apt_pkgmodule.cc14
-rw-r--r--python/cache.cc8
4 files changed, 68 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index c2377956..3b2a739a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,9 @@ python-apt (0.8.0~exp3) UNRELEASED; urgency=low
[ Stéphane Graber ]
* Update enable_component to also apply to -src entries (LP: #758732)
+
+ [ Julian Andres Klode ]
+ * apt_pkg: Add apt_pkg.Version.multi_arch and friends
-- Julian Andres Klode <jak@debian.org> Tue, 12 Apr 2011 17:19:49 +0200
diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst
index 72ca5ecc..28914395 100644
--- a/doc/source/library/apt_pkg.rst
+++ b/doc/source/library/apt_pkg.rst
@@ -758,6 +758,49 @@ Example:
.. attribute:: installed_size
The size of the package (in kilobytes), when unpacked on the disk.
+
+ .. attribute:: multi_arch
+
+ The multi-arch state of the package. Can be one of the following
+ attributes.
+
+ .. attribute:: MULTI_ARCH_NONE
+
+ No multi-arch
+
+ .. attribute:: MULTI_ARCH_ALL
+
+ An ``Architecture: all`` package
+
+
+ .. attribute:: MULTI_ARCH_FOREIGN
+
+ Can satisfy dependencies of foreign-architecture
+ packages
+
+ .. attribute:: MULTI_ARCH_ALL_FOREIGN
+
+ :attr:`MULTI_ARCH_FOREIGN` for ``Architecture: all``
+ packages.
+
+ .. attribute:: MULTI_ARCH_SAME
+
+ Multiple versions from different architectures may be
+ installed in parallel, but may only satisfy dependencies
+ of packages from the same architecture
+
+ .. attribute:: MULTI_ARCH_ALLOWED
+
+ Installation in parallel and satisfying ``pkg:any``
+ style dependencies is allowed.
+
+ .. attribute:: MULTI_ARCH_ALL_ALLOWED
+
+ :attr:`MULTI_ARCH_ALLOWED` for ``Architecture: all``
+ packages.
+
+
+
.. attribute:: parent_pkg
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index 2394b0f8..a8b8d2f4 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -905,6 +905,20 @@ extern "C" void initapt_pkg()
MkPyNumber(pkgPackageManager::Incomplete));
#endif
+ PyDict_SetItemString(PyVersion_Type.tp_dict, "MULTI_ARCH_NONE",
+ MkPyNumber(pkgCache::Version::None));
+ PyDict_SetItemString(PyVersion_Type.tp_dict, "MULTI_ARCH_ALL",
+ MkPyNumber(pkgCache::Version::All));
+ PyDict_SetItemString(PyVersion_Type.tp_dict, "MULTI_ARCH_FOREIGN",
+ MkPyNumber(pkgCache::Version::Foreign));
+ PyDict_SetItemString(PyVersion_Type.tp_dict, "MULTI_ARCH_SAME",
+ MkPyNumber(pkgCache::Version::Same));
+ PyDict_SetItemString(PyVersion_Type.tp_dict, "MULTI_ARCH_ALLOWED",
+ MkPyNumber(pkgCache::Version::Allowed));
+ PyDict_SetItemString(PyVersion_Type.tp_dict, "MULTI_ARCH_ALL_FOREIGN",
+ MkPyNumber(pkgCache::Version::AllForeign));
+ PyDict_SetItemString(PyVersion_Type.tp_dict, "MULTI_ARCH_ALL_ALLOWED",
+ MkPyNumber(pkgCache::Version::AllAllowed));
// AcquireItem Constants.
PyDict_SetItemString(PyAcquireItem_Type.tp_dict, "STAT_IDLE",
MkPyNumber(pkgAcquire::Item::StatIdle));
diff --git a/python/cache.cc b/python/cache.cc
index 160fd208..b263d320 100644
--- a/python/cache.cc
+++ b/python/cache.cc
@@ -1047,6 +1047,11 @@ static PyObject *VersionGetTranslatedDescription(PyObject *Self, void*) {
Ver.TranslatedDescription());
}
+static PyObject *VersionGetMultiArch(PyObject *Self, void*)
+{
+ return MkPyNumber(Version_GetVer(Self)->MultiArch);
+}
+
#if 0 // FIXME: enable once pkgSourceList is stored somewhere
static PyObject *VersionGetIsTrusted(PyObject *Self, void*) {
else if (strcmp("IsTrusted", Name) == 0)
@@ -1122,6 +1127,9 @@ static PyGetSetDef VersionGetSet[] = {
"The numeric ID of the package."},
{"installed_size",VersionGetInstalledSize,0,
"The installed size of this package version."},
+ {"multi_arch",VersionGetMultiArch,0,
+ "Multi-arch state of this package, as an integer. See\n"
+ "the various MULTI_ARCH_* members."},
{"parent_pkg",VersionGetParentPkg,0,
"The parent package of this version."},
{"priority",VersionGetPriority,0,