summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-04-27 00:23:03 +0000
committerZac Medico <zmedico@gentoo.org>2008-04-27 00:23:03 +0000
commitb3aaf3fe867ccb1f9cbb088be5217fe4c7116021 (patch)
treec8f53b5cd1f5310516c0862c2efd4c5b4fb4f29d /bin
parent065fb3de81a3ab8d8a5a34c2d47dd6fbef69ff1d (diff)
downloadportage-b3aaf3fe867ccb1f9cbb088be5217fe4c7116021.tar.gz
portage-b3aaf3fe867ccb1f9cbb088be5217fe4c7116021.tar.bz2
portage-b3aaf3fe867ccb1f9cbb088be5217fe4c7116021.zip
* Add a Blocker class to use instead of tuples.
* Fix the Task constructor to properly traverse __slots__ of all inherited classes. (trunk r9979) svn path=/main/branches/2.1.2/; revision=9985
Diffstat (limited to 'bin')
-rwxr-xr-xbin/emerge29
1 files changed, 24 insertions, 5 deletions
diff --git a/bin/emerge b/bin/emerge
index 9aba5e6db..52975a86a 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -1348,11 +1348,18 @@ class Task(object):
__slots__ = ("__weakref__", "_hash_key",)
def __init__(self, **kwargs):
- for myattr in self.__slots__:
- if myattr == "__weakref__":
+ classes = [self.__class__]
+ while classes:
+ c = classes.pop()
+ if c is Task:
continue
- myvalue = kwargs.get(myattr, None)
- setattr(self, myattr, myvalue)
+ classes.extend(c.__bases__)
+ slots = getattr(c, "__slots__", None)
+ if not slots:
+ continue
+ for myattr in slots:
+ myvalue = kwargs.get(myattr, None)
+ setattr(self, myattr, myvalue)
def _get_hash_key(self):
try:
@@ -1384,6 +1391,17 @@ class Task(object):
def __str__(self):
return str(self._get_hash_key())
+class Blocker(Task):
+ __slots__ = ("root", "atom")
+
+ def _get_hash_key(self):
+ try:
+ return self._hash_key
+ except AttributeError:
+ self._hash_key = \
+ ("blocks", self.root, self.atom)
+ return self._hash_key
+
class Package(Task):
__slots__ = ("built", "cpv", "depth",
"installed", "metadata", "root", "onlydeps", "type_name",
@@ -1424,6 +1442,7 @@ class Package(Task):
return False
class Uninstall(Package):
+ __slots__ = ()
def _get_hash_key(self):
try:
return self._hash_key
@@ -2010,7 +2029,7 @@ class depgraph(object):
# The blocker applies to the root where
# the parent is or will be installed.
self.blocker_parents.setdefault(
- ("blocks", dep.parent.root, dep.atom), set()).add(
+ Blocker(atom=dep.atom, root=dep.parent.root), set()).add(
dep.parent)
return 1
dep_pkg, existing_node = self._select_package(dep.root, dep.atom,