summaryrefslogtreecommitdiff
path: root/apt/package.py
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 /apt/package.py
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.
Diffstat (limited to 'apt/package.py')
-rw-r--r--apt/package.py13
1 files changed, 13 insertions, 0 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.