summaryrefslogtreecommitdiff
path: root/geneticone/backend/package.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--geneticone/backend/package.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/geneticone/backend/package.py b/geneticone/backend/package.py
index 8991117..0f53e3c 100644
--- a/geneticone/backend/package.py
+++ b/geneticone/backend/package.py
@@ -31,15 +31,26 @@ class Package (gentoolkit.Package):
if isinstance(cpv, gentoolkit.Package):
cpv = cpv.get_cpv()
gentoolkit.Package.__init__(self, cpv)
- self._status = portage.getmaskingstatus(self.get_cpv(), settings = gentoolkit.settings)
+ try:
+ self._status = portage.getmaskingstatus(self.get_cpv(), settings = gentoolkit.settings)
+ except KeyError: # package is not located in the system
+ self._status = None
+ def is_in_system (self):
+ """Returns False if the package could not be found in the portage system.
+
+ @return: True if in portage system; else False
+ @rtype: boolean"""
+
+ return (self._status != None)
+
def is_missing_keyword(self):
"""Returns True if the package is missing the needed keyword.
@return: True if keyword is missing; else False
@rtype: boolean"""
- if "missing keyword" in self._status:
+ if self._status and "missing keyword" in self._status:
return True
return False
@@ -60,7 +71,7 @@ class Package (gentoolkit.Package):
else: # keywords are taken into account
status = flags.new_testing_status(self.get_cpv())
if status == None: # we haven't changed it in any way
- if testArch+" keyword" in self._status:
+ if self._status and testArch+" keyword" in self._status:
return True
return False
else:
@@ -92,7 +103,7 @@ class Package (gentoolkit.Package):
else:
debug("BUG in flags.new_masking_status. It returns",status)
else: # we have not touched the status
- if "profile" in self._status or "package.mask" in self._status:
+ if self._status and ("profile" in self._status or "package.mask" in self._status):
return True
return False
>René 'Necoro' Neumann2-40/+0 2009-08-27Only import stuff if necessaryRené 'Necoro' Neumann1-8/+8 2009-08-25Release the threadQueue-Lock in syncv0.13René 'Necoro' Neumann1-0/+1 2009-08-25Updated portugese translationAlberto Federman Neto1-650/+687 2009-08-15Update spanish translationDaniel Halens1-245/+258 2009-08-15Use boolean flags instead of obscure C flags for ipc.MessageQueueRené 'Necoro' Neumann3-13/+15 2009-08-15TypoRené 'Necoro' Neumann1-1/+1 2009-08-15Enhanced the extensions.shRené 'Necoro' Neumann1-3/+8 2009-08-15Move eix-format to correct locationRené 'Necoro' Neumann1-0/+0