diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-11-17 20:28:10 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-11-17 20:28:10 +0100 |
| commit | a01e314df3ceaf0cc99102beb511a2ecbd973057 (patch) | |
| tree | 5f7f80d37418cf198e6d97ffafcfa64f7719ae77 | |
| parent | add08632b8a66c7ba5de7ab44d8a10ec9462692e (diff) | |
| download | python-apt-a01e314df3ceaf0cc99102beb511a2ecbd973057.tar.gz | |
make Dependency a list (it should probably also renamed to DependencyOrGroup or something), thanks to Christop Groth
| -rw-r--r-- | apt/package.py | 14 | ||||
| -rw-r--r-- | debian/changelog | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/apt/package.py b/apt/package.py index ab692788..8b79c420 100644 --- a/apt/package.py +++ b/apt/package.py @@ -94,7 +94,7 @@ class BaseDependency(object): preDepend = AttributeDeprecatedBy('pre_depend') -class Dependency(object): +class Dependency(list): """Represent an Or-group of dependencies. Attributes defined here: @@ -102,14 +102,12 @@ class Dependency(object): """ def __init__(self, alternatives): - self.or_dependencies = alternatives - - def __repr__(self): - return repr(self.or_dependencies) - - def __iter__(self): - return self.or_dependencies.__iter__() + super(Dependency, self).__init__() + self.extend(alternatives) + @property + def or_dependencies(self): + return self class DeprecatedProperty(property): """A property which gives DeprecationWarning on access. diff --git a/debian/changelog b/debian/changelog index 7d939702..6e750980 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,7 +27,9 @@ python-apt (0.8.2) UNRELEASED; urgency=low - allow Dependency object to be iteratable, this allows to write code like: for or_dep_group in pkg.candidate.dependencies: - for dep in or_dep_group: do_something() + for dep in or_dep_group: + do_something() + (thanks to Christop Groth) [ Tshepang Lekhonkhobe ] * rm usage of camelcase in cache.py doc (closes: #626617) |
