summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt/cache.py4
-rw-r--r--apt/package.py5
-rw-r--r--debian/changelog1
-rw-r--r--tests/test_enhances.py17
4 files changed, 26 insertions, 1 deletions
diff --git a/apt/cache.py b/apt/cache.py
index aa38999d..ae6f2fcc 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -47,7 +47,9 @@ class Cache(object):
Keyword arguments:
progress -- a OpProgress object
- rootdir -- a alternative root directory
+ rootdir -- a alternative root directory. if that is given
+ the system sources.list and system lists/ files are
+ not read, only files relative to the given rootdir
memonly -- build the cache in memory only
"""
diff --git a/apt/package.py b/apt/package.py
index 8d3be1b0..f33871c6 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -379,6 +379,11 @@ class Version(object):
return depends_list
@property
+ def enhances(self):
+ """Return the list of enhances for the package version."""
+ return self.get_dependencies("Enhances")
+
+ @property
def dependencies(self):
"""Return the dependencies of the package version."""
return self.get_dependencies("PreDepends", "Depends")
diff --git a/debian/changelog b/debian/changelog
index 59409cb4..ba5dd918 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ python-apt (0.7.13.5) UNRELEASED; urgency=low
- simple abstraction for the apt history file
* apt/cache.py:
- improved docstring for the cache
+ - add "enhances" property
* data/templates/Ubuntu.info.in:
- add lucid
diff --git a/tests/test_enhances.py b/tests/test_enhances.py
new file mode 100644
index 00000000..3eced9f9
--- /dev/null
+++ b/tests/test_enhances.py
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+
+import apt
+
+cache = apt.Cache()
+
+for pkg in cache:
+ if pkg.installed and pkg.installed.enhances:
+ s = "%s enhances:" % pkg.name
+ for or_list in pkg.installed.enhances:
+ for enhances in or_list.or_dependencies:
+ s += " %s" % enhances.name
+ if (cache.has_key(enhances.name) and
+ not cache[enhances.name].isInstalled):
+ s += "(*missing*) "
+ s += ","
+ print s[:-1]