diff options
author | 2010-05-19 18:15:00 +0200 | |
---|---|---|
committer | 2010-05-20 02:50:05 -0700 | |
commit | e37dc80c145d36eb1c76c17bf0ae5a3927b09a64 (patch) | |
tree | c86be6e65d950ac0b008e533aa3a8376675ff386 | |
parent | Support specifying exclude list as multiple arguments. (diff) | |
download | portage-idfetch-e37dc80c145d36eb1c76c17bf0ae5a3927b09a64.tar.gz portage-idfetch-e37dc80c145d36eb1c76c17bf0ae5a3927b09a64.tar.bz2 portage-idfetch-e37dc80c145d36eb1c76c17bf0ae5a3927b09a64.zip |
Add _emerge.Package.__str__() for nicer output formatting
-rw-r--r-- | pym/_emerge/Package.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index 8e0c3789..adbd0f45 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -137,6 +137,34 @@ class Package(Task): self.invalid[msg_type] = msgs 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" + else: + cpv_color = "PKG_MERGE" + else: + cpv_color = "PKG_NOMERGE" + + s = "(%s, %s" \ + % (portage.output.colorize(cpv_color, self.cpv) , self.type_name) + + if self.type_name == "installed": + if self.root != "/": + s += " in '%s'" % self.root + else: + if self.operation == "merge": + s += " scheduled for merge" + if self.root != "/": + s += " to '%s'" % self.root + s += ")" + return s + class _use_class(object): __slots__ = ("__weakref__", "enabled") |