diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2008-03-04 21:08:28 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2008-03-04 21:08:28 +0100 |
commit | da80e4fcaaa9bbeac8df8bbd548391b3d38cbfbe (patch) | |
tree | e8f587adf7583fd2c2a6a944c61b171046d526cf /portato/backend | |
parent | e505874effd968d77d9675a6dcfa63ce1c3b1e35 (diff) | |
download | portato-da80e4fcaaa9bbeac8df8bbd548391b3d38cbfbe.tar.gz portato-da80e4fcaaa9bbeac8df8bbd548391b3d38cbfbe.tar.bz2 portato-da80e4fcaaa9bbeac8df8bbd548391b3d38cbfbe.zip |
No more dict-hackery for the dependencies
Diffstat (limited to '')
-rw-r--r-- | portato/backend/portage/package.py | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py index 6ac34ba..e54d1cd 100644 --- a/portato/backend/portage/package.py +++ b/portato/backend/portage/package.py @@ -17,6 +17,7 @@ from .. import flags from .. import system from ..exceptions import BlockedException, PackageNotFoundException, DependencyCalcError from ...helper import debug, error, unique_array +from ...dependency import DependencyTree import portage, portage_dep @@ -305,33 +306,30 @@ class PortagePackage (Package): def get_dependencies (self): deps = " ".join(map(self.get_package_settings, ("RDEPEND", "PDEPEND", "DEPEND"))) deps = portage_dep.paren_reduce(deps) - depdir = {"global": set()} + + tree = DependencyTree() - def add (dir, deps): + def add (tree, deps): iter = (x for x in deps) for dep in iter: if dep.endswith("?"): - dep = dep[:-1] - if dep not in dir: - dir[dep] = {"global": set()} + ntree = tree.add_flag(dep[:-1]) n = iter.next() - if isinstance(n, list): - add(dir[dep], n) - else: - dir[dep]["global"].add(n) - elif dep == "||": - if not dep in dir: - dir[dep] = set() - + if not hasattr(n, "__iter__"): + n = (n,) + add(ntree, n) + + elif dep == "||": n = iter.next() # skip - if not isinstance(n, list): + if not hasattr(n, "__iter__"): n = tuple(n,) else: n = tuple(n) - dir[dep].add(n) + tree.add_or(n) + else: - dir["global"].add(dep) + tree.add(dep) - add(depdir, deps) - return depdir + add(tree, deps) + return tree |