summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to 'portato')
-rw-r--r--portato/backend/package.py16
-rw-r--r--portato/backend/portage/package.py2
-rw-r--r--portato/backend/portage/system.py4
-rw-r--r--portato/gui/windows/main.py2
4 files changed, 18 insertions, 6 deletions
diff --git a/portato/backend/package.py b/portato/backend/package.py
index c085816..89d1528 100644
--- a/portato/backend/package.py
+++ b/portato/backend/package.py
@@ -27,6 +27,7 @@ class Package (_Package):
@type cpv: string (cat/pkg-ver)"""
self._cpv = cpv
+ self._slot = None
def __repr__ (self):
return "<Package '%s' @0x%x>" % (self._cpv, id(self))
@@ -154,15 +155,26 @@ class Package (_Package):
@returns: category/package.
@rtype: string"""
- return self.get_category()+"/"+self.get_name()
+ return "/".join(self.get_category(), self.get_name())
+ def get_slot (self):
+ """Returns the slot.
+
+ @returns: Slot
+ @rtype: string"""
+
+ if self._slot is None:
+ self._slot = self.get_package_settings("SLOT")
+
+ return self._slot
+
def get_slot_cp (self):
"""Returns the current cp followed by a colon and the slot-number.
@returns: cp:slot
@rtype: string"""
- return ("%s:%s" % (self.get_cp(), self.get_package_settings("SLOT")))
+ return ":".join(self.get_cp(), self.get_slot())
def get_package_path(self):
"""Returns the path to where the ChangeLog, Manifest, .ebuild files reside.
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py
index 79af79b..f108bde 100644
--- a/portato/backend/portage/package.py
+++ b/portato/backend/portage/package.py
@@ -299,5 +299,5 @@ class PortagePackage (Package):
def matches (self, criterion):
# cpv_matches needs explicit slot info
- scpv = "%s:%s" % (self.get_cpv(), self.get_package_settings("SLOT"))
+ scpv = ":".join(self.get_cpv(), self.get_slot())
return system.cpv_matches(scpv, criterion)
diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py
index 83eb37a..03e3955 100644
--- a/portato/backend/portage/system.py
+++ b/portato/backend/portage/system.py
@@ -280,9 +280,9 @@ class PortageSystem (SystemInterface):
if len(inst) > 1:
myslots = set()
for i in inst: # get the slots of the installed packages
- myslots.add(i.get_package_settings("SLOT"))
+ myslots.add(i.get_slot())
- myslots.add(best_p.get_package_settings("SLOT")) # add the slot of the best package in portage
+ myslots.add(best_p.get_slot()) # add the slot of the best package in portage
for slot in myslots:
crit = "%s:%s" % (p, slot)
append(crit, self.find_best_match(crit), inst)
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index 5a149f8..ca88b04 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -768,7 +768,7 @@ class MainWindow (Window):
# to not query the package with info, we do not need
if self.cfg.get_boolean("showSlots", "GUI"):
def get_slot(pkg):
- return pkg.get_package_settings("SLOT")
+ return pkg.get_slot()
self.slotcol.set_visible(True)