From: Zac Medico Date: Wed, 22 Dec 2010 19:35:29 +0000 (-0800) Subject: Package.operation: eliminate duplicate code X-Git-Tag: v2.2.0_alpha11~47 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=be81a5710319d5c8740030a9febeeed52a03f696;p=portage.git Package.operation: eliminate duplicate code --- 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.