diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-12-22 11:35:29 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-12-22 14:43:35 -0800 |
commit | f4f52959268cf0e0989bfb2abd6da6005765e355 (patch) | |
tree | f33c45d2c75152a44db382d3bfe725ceb41c642c | |
parent | 54d78e5686fd19f3963b9f5641793a3e2ea56dd3 (diff) | |
download | portage-f4f52959268cf0e0989bfb2abd6da6005765e355.tar.gz portage-f4f52959268cf0e0989bfb2abd6da6005765e355.tar.bz2 portage-f4f52959268cf0e0989bfb2abd6da6005765e355.zip |
Package.operation: eliminate duplicate code
-rw-r--r-- | pym/_emerge/Package.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index 47a435f21..13119d229 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -67,6 +67,11 @@ class Package(Task): self._validate_deps() self.masks = self._masks() self.visible = self._visible(self.masks) + if self.operation is None: + if self.onlydeps or self.installed: + self.operation = "nomerge" + else: + self.operation = "merge" def _validate_deps(self): """ @@ -267,11 +272,6 @@ class Package(Task): msgs.append(msg) def __str__(self): - if self.operation is None: - self.operation = "merge" - if self.onlydeps or self.installed: - self.operation = "nomerge" - if self.operation == "merge": if self.type_name == "binary": cpv_color = "PKG_BINARY_MERGE" @@ -406,10 +406,6 @@ class Package(Task): def _get_hash_key(self): hash_key = getattr(self, "_hash_key", None) if hash_key is None: - if self.operation is None: - self.operation = "merge" - if self.onlydeps or self.installed: - self.operation = "nomerge" self._hash_key = \ (self.type_name, self.root, self.cpv, self.operation) return self._hash_key |