From be81a5710319d5c8740030a9febeeed52a03f696 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 22 Dec 2010 11:35:29 -0800 Subject: [PATCH] Package.operation: eliminate duplicate code --- pym/_emerge/Package.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index 009808f5f..0b3375edc 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -73,6 +73,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): """ @@ -273,11 +278,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" @@ -416,10 +416,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" # For installed (and binary) packages we don't care for the repo # when it comes to hashing, because there can only be one cpv. # So overwrite the repo_key with type_name. -- 2.26.2