diff options
Diffstat (limited to '')
-rw-r--r-- | portato/backend/package.py | 8 | ||||
-rw-r--r-- | portato/dependency.py | 5 | ||||
-rw-r--r-- | portato/gui/windows/main.py | 16 |
3 files changed, 18 insertions, 11 deletions
diff --git a/portato/backend/package.py b/portato/backend/package.py index 0ac22d3..1e17b1f 100644 --- a/portato/backend/package.py +++ b/portato/backend/package.py @@ -181,21 +181,21 @@ class Package (_Package): tree = DependencyTree() def add (tree, deps): - iter = (x for x in deps) - for dep in iter: + it = iter(deps) + for dep in it: if hasattr(dep, "__iter__"): debug("Following dep is an unsupposed list: %s", dep) assert(len(dep) == 1) dep = dep[0] if dep.endswith("?"): ntree = tree.add_flag(dep[:-1]) - n = iter.next() + n = it.next() if not hasattr(n, "__iter__"): n = (n,) add(ntree, n) elif dep == "||": - n = iter.next() # skip + n = it.next() # skip if not hasattr(n, "__iter__"): n = [n] else: diff --git a/portato/dependency.py b/portato/dependency.py index cefc6ad..cce7360 100644 --- a/portato/dependency.py +++ b/portato/dependency.py @@ -63,10 +63,10 @@ class Dependency (object): __repr__ = __str__ - def _get_dep (self): + @property + def dep (self): return self._dep - dep = property(_get_dep) satisfied = property(is_satisfied) class OrDependency (Dependency): @@ -92,6 +92,7 @@ class OrDependency (Dependency): _dep = [] for dep in deps: if not hasattr(dep, "__iter__"): + assert not dep.endswith("?") _dep.append(Dependency(dep)) else: _dep.append(AllOfDependency(dep)) diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index cde7461..14a0181 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -193,7 +193,7 @@ class PackageTable: ftexts = [] for count, t in enumerate(texts): - if not t.startswith(("http:", "ftp:")): + if not t.startswith(("http", "ftp")): if count == 0: error(_("The first homepage part does not start with 'http' or 'ftp'.")) ftexts.append(t) @@ -225,9 +225,8 @@ class PackageTable: def fill_dep_list(self): - deptree = self.actual_package().get_dependencies() store = self.depList.get_model() - + def add (tree, it): def get_icon (dep): @@ -274,8 +273,15 @@ class PackageTable: ndeps.sort(key = sort_key) for dep in ndeps: store.append(it, [get_icon(dep), dep.dep]) - - add (deptree, None) + + try: + deptree = self.actual_package().get_dependencies() + except AssertionError: + w = _("Can't display dependencies: This package has an unsupported dependency string.") + error(w) + store.append(None, [None, w]) + else: + add(deptree, None) def fill_use_list(self): |