summaryrefslogtreecommitdiff
path: root/portato/backend
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2008-04-17 10:45:22 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2008-04-17 10:45:22 +0200
commitda138a749908cb653de6f1b96c806bab5bd0f7d3 (patch)
tree6fa8ee99930bb90aa761aa514168231aa3a0bf82 /portato/backend
parentc8ab8375fe4f719ca484b0f395fd3812c73444aa (diff)
downloadportato-da138a749908cb653de6f1b96c806bab5bd0f7d3.tar.gz
portato-da138a749908cb653de6f1b96c806bab5bd0f7d3.tar.bz2
portato-da138a749908cb653de6f1b96c806bab5bd0f7d3.zip
Make get_package_settings take an 'installed' argument instead of a tree
Diffstat (limited to '')
-rw-r--r--portato/backend/package.py6
-rw-r--r--portato/backend/portage/package.py25
2 files changed, 14 insertions, 17 deletions
diff --git a/portato/backend/package.py b/portato/backend/package.py
index 16148d2..4dc439a 100644
--- a/portato/backend/package.py
+++ b/portato/backend/package.py
@@ -369,13 +369,13 @@ class Package (_Package):
raise NotImplementedError
- def get_package_settings(self, var, tree = None):
+ def get_package_settings(self, var, installed = True):
"""Returns a package specific setting, such as DESCRIPTION, SRC_URI, IUSE ...
@param var: the setting to get
@type var: string
- @param tree: an object defining whether to take the information from the installed package or from the ebuild
- @type tree: unknown
+ @param installed: take the vartree or the porttree
+ @type installed: boolean
@returns: the value of the setting
@rtype: string"""
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py
index 5f1fa74..37fa230 100644
--- a/portato/backend/portage/package.py
+++ b/portato/backend/portage/package.py
@@ -163,12 +163,10 @@ class PortagePackage (Package):
return reason
def get_iuse_flags (self, installed = False, removeForced = True):
- if installed or not self.is_in_system():
- tree = self._settings.vartree
- else:
- tree = self._settings.porttree
+ if not self.is_in_system():
+ installed = True
- iuse = flags.filter_defaults(self.get_package_settings("IUSE", tree = tree).split())
+ iuse = flags.filter_defaults(self.get_package_settings("IUSE", installed = installed).split())
iuse = set(iuse)
@@ -184,11 +182,11 @@ class PortagePackage (Package):
depstring = ""
try:
for d in depvar:
- depstring += self.get_package_settings(d, tree = self._settings.porttree)+" "
+ depstring += self.get_package_settings(d, installed = False)+" "
except KeyError: # not found in porttree - use vartree
depstring = ""
for d in depvar:
- depstring += self.get_package_settings(d, tree = self._settings.vartree)+" "
+ depstring += self.get_package_settings(d, installed = True)+" "
deps = portage.dep_check(depstring, None, self._settings.settings, myuse = actual, trees = self._trees)
@@ -210,7 +208,7 @@ class PortagePackage (Package):
depstring = ""
for d in depvar:
- depstring += self.get_package_settings(d, tree=self._settings.porttree)+" "
+ depstring += self.get_package_settings(d, installed = False)+" "
# let portage do the main stuff ;)
# pay attention to any changes here
@@ -280,20 +278,19 @@ class PortagePackage (Package):
for line in f:
yield line.split()[1].strip()
- def get_package_settings(self, var, tree = None):
- if not tree:
+ def get_package_settings(self, var, installed = True):
+ if installed and self.is_installed():
mytree = self._settings.vartree
- if not self.is_installed():
- mytree = self._settings.porttree
else:
- mytree = tree
+ mytree = self._settings.porttree
+
r = mytree.dbapi.aux_get(self._cpv,[var])
return r[0]
def get_installed_use_flags(self):
if self.is_installed():
- return self.get_package_settings("USE", tree = self._settings.vartree).split()
+ return self.get_package_settings("USE", installed = True).split()
else: return []
def compare_version(self,other):