summaryrefslogtreecommitdiff
path: root/portato/dependency.py
diff options
context:
space:
mode:
Diffstat (limited to 'portato/dependency.py')
-rw-r--r--portato/dependency.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/portato/dependency.py b/portato/dependency.py
index 91e4fb5..a52a630 100644
--- a/portato/dependency.py
+++ b/portato/dependency.py
@@ -19,6 +19,7 @@ __docformat__ = "restructuredtext"
from .helper import debug
+from .backend import system
class Dependency (object):
@@ -29,6 +30,9 @@ class Dependency (object):
dep : string
The dependency string. It is immutable.
+
+ satisfied : boolean
+ Is this dependency satisfied?
"""
def __init__ (self, dep):
@@ -38,7 +42,15 @@ class Dependency (object):
:param dep: dependency string
:type dep: string
"""
- self.__dep = dep
+ self._dep = dep
+
+ def is_satisfied (self):
+ """
+ Checks if this dependency is satisfied.
+
+ :rtype: boolean
+ """
+ return system.find_best_match(self.dep, only_cpv = True, only_installed = True) is not None
def __cmp__ (self, b):
return cmp(self.dep, b.dep)
@@ -51,13 +63,13 @@ class Dependency (object):
__repr__ = __str__
- def __get_dep (self):
- return self.__dep
+ def _get_dep (self):
+ return self._dep
- dep = property(__get_dep)
+ dep = property(_get_dep)
+ satisfied = property(is_satisfied)
class OrDependency (Dependency):
-
"""
Dependency representing an "or".
@@ -77,7 +89,7 @@ class OrDependency (Dependency):
:type deps: iter<string>
"""
- self.__dep = tuple(Dependency(dep) for dep in deps)
+ self._dep = tuple(Dependency(dep) for dep in deps)
def __str__ (self):
return "<|| %s>" % str(self.dep)
gory 2008-01-14 r617@Devoty: necoro | 2008-01-14 19:12:59 +0100Necoro2-10/+10 Remove unnecessairy loads of the shm module 2008-01-14 r609@Devoty: necoro | 2008-01-14 17:04:38 +0100Necoro9-394/+477 Allowed '-' and '_' in key names. Also use group names instead of their number. r610@Devoty: necoro | 2008-01-14 17:05:42 +0100 Disabled saving of the queues r611@Devoty: necoro | 2008-01-14 17:08:53 +0100 Added the possibility to permanently en-/disable plugins r612@Devoty: necoro | 2008-01-14 17:14:09 +0100 adjust changelog and translations r613@Devoty: necoro | 2008-01-14 17:40:53 +0100 Dropdown should be localized too 2008-01-14 r605@Devoty: necoro | 2008-01-14 11:43:34 +0100Necoro2-26/+129 Updated shm module to version 1.1.4 2008-01-14 r603@Devoty: necoro | 2008-01-14 11:30:26 +0100Necoro4-26/+38 Improved 'update world'; really support new use defaults 2008-01-11 r598@Devoty: necoro | 2008-01-10 16:36:29 +0100Necoro4-10/+50 Handle the new useflag format correctly 2008-01-11 r597@Devoty: necoro | 2008-01-10 14:12:35 +0100Necoro1-3/+3 updated todo 2008-01-10 r595@Devoty: necoro | 2008-01-10 04:04:15 +0100Necoro1-52/+3 Re-Introduced etc-proposals 2008-01-09 r586@Devoty: necoro | 2008-01-09 14:54:18 +0100Necoro1-1/+1 Disabled catapult till it is really usable 2007-12-06 r577@Devoty: necoro | 2007-12-06 20:37:36 +0100Necoro1-1/+1 Fixed desktop file 2007-12-06 r572@Devoty: necoro | 2007-11-28 08:48:15 +0100Necoro1-0/+1 2007-11-27 r570@Devoty: necoro | 2007-11-27 02:08:21 +0100Necoro3-84/+108 Added scrollbars to update window