summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-06-22 14:54:31 +0200
committerJulian Andres Klode <jak@debian.org>2009-06-22 14:54:31 +0200
commitb426f959e7e515d5f267558b6ae51ed9ae03fb9d (patch)
tree2d63294629509f8ff249aede85b1d7f55582e2ea
parent5e72b1f4f302e86a75399694d293e09a58d4bdbe (diff)
downloadpython-apt-b426f959e7e515d5f267558b6ae51ed9ae03fb9d.tar.gz
Add apt_pkg.DepCache.mark_auto() and apt.Package.mark_auto() methods to
mark a package as automatically installed.
-rw-r--r--apt/package.py13
-rw-r--r--debian/changelog4
-rw-r--r--python/depcache.cc18
3 files changed, 34 insertions, 1 deletions
diff --git a/apt/package.py b/apt/package.py
index cb99fe6a..39a73c07 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -846,6 +846,10 @@ class Package(object):
return self.is_installed and \
self._pcache._depcache.is_garbage(self._pkg)
+ @property
+ def is_auto_installed(self):
+ """Return whether the package is marked as automatically installed."""
+ return self._pcache._depcache.is_auto_installed(self._pkg)
# sizes
@DeprecatedProperty
@@ -1135,6 +1139,15 @@ class Package(object):
sys.stderr.write(("MarkUpgrade() called on a non-upgrable pkg: "
"'%s'\n") % self._pkg.name)
+ def mark_auto(self, auto=True):
+ """Mark a package as automatically installed.
+
+ Call this function to mark a package as automatically installed. If the
+ optional parameter *auto* is set to ``False``, the package will not be
+ marked as automatically installed anymore. The default is ``True``.
+ """
+ self._pcache._depcache.mark_auto(self._pkg, auto)
+
def commit(self, fprogress, iprogress):
"""Commit the changes.
diff --git a/debian/changelog b/debian/changelog
index 4fb6b0de..f0b3efbe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ python-apt (0.7.92) UNRELEASED; urgency=low
properties (Closes: #532338)
* apt/cache.py: Correctly handle rootdir on second and later invocations of
open() (LP: #320665).
+ * Add apt_pkg.DepCache.mark_auto() and apt.Package.mark_auto() methods to
+ mark a package as automatically installed.
[ Sebastian Heinlein ]
* apt/progress.py: Extract the package name from the status message
@@ -28,7 +30,7 @@ python-apt (0.7.92) UNRELEASED; urgency=low
* python/progress.cc:
- low level code for update_status_full and pulse_items()
- -- Julian Andres Klode <jak@debian.org> Mon, 15 Jun 2009 14:45:06 +0200
+ -- Julian Andres Klode <jak@debian.org> Mon, 22 Jun 2009 14:38:19 +0200
python-apt (0.7.91) experimental; urgency=low
diff --git a/python/depcache.cc b/python/depcache.cc
index d0b233b8..e1514300 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -367,6 +367,23 @@ static PyObject *PkgDepCacheMarkInstall(PyObject *Self,PyObject *Args)
return HandleErrors(Py_None);
}
+static PyObject *PkgDepCacheMarkAuto(PyObject *Self,PyObject *Args)
+{
+ pkgDepCache *depcache = GetCpp<pkgDepCache*>(Self);
+
+ PyObject *PackageObj;
+ char value = 0;
+ if (PyArg_ParseTuple(Args,"O!b",&PackageType,&PackageObj, &value) == 0)
+ return 0;
+
+ pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj);
+ depcache->MarkAuto(Pkg,value);
+
+ Py_INCREF(Py_None);
+ return HandleErrors(Py_None);
+}
+
+
static PyObject *PkgDepCacheIsUpgradable(PyObject *Self,PyObject *Args)
{
pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self);
@@ -541,6 +558,7 @@ static PyMethodDef PkgDepCacheMethods[] =
{"mark_keep",PkgDepCacheMarkKeep,METH_VARARGS,"Mark package for keep"},
{"mark_delete",PkgDepCacheMarkDelete,METH_VARARGS,"Mark package for delete (optional boolean argument if it should be purged)"},
{"mark_install",PkgDepCacheMarkInstall,METH_VARARGS,"Mark package for Install"},
+ {"mark_auto",PkgDepCacheMarkAuto,METH_VARARGS,"mark_auto(pkg: apt_pkg.Package, auto: bool)\n\nMark package as automatically installed."},
{"set_reinstall",PkgDepCacheSetReInstall,METH_VARARGS,"Set if the package should be reinstalled"},
// state information
{"is_upgradable",PkgDepCacheIsUpgradable,METH_VARARGS,"Is pkg upgradable"},