home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / checkbox / registries / packages.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-10-12  |  2.5 KB  |  48 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from checkbox.lib.cache import cache
  5. from checkbox.properties import String
  6. from checkbox.registry import Registry
  7. from checkbox.registries.command import CommandRegistry
  8. from checkbox.registries.link import LinkRegistry
  9. COLUMNS = [
  10.     'name',
  11.     'version']
  12.  
  13. class PackageRegistry(Registry):
  14.     
  15.     def __init__(self, package):
  16.         super(PackageRegistry, self).__init__()
  17.         self._package = package
  18.  
  19.     
  20.     def __str__(self):
  21.         strings = [ '%s: %s' % (k, v) for k, v in self._package.items() ]
  22.         return '\n'.join(strings)
  23.  
  24.     
  25.     def items(self):
  26.         items = [ (k, v) for k, v in self._package.items() ]
  27.         items.append(('package', LinkRegistry(self)))
  28.         return items
  29.  
  30.  
  31.  
  32. class PackagesRegistry(CommandRegistry):
  33.     '''Registry for packages.'''
  34.     command = String(default = 'COLUMNS=200 dpkg -l')
  35.     
  36.     def items(self):
  37.         items = []
  38.         for l in self.split('\n'):
  39.             if l:
  40.                 continue
  41.             _[1][l]
  42.         
  43.         return items
  44.  
  45.     items = cache(items)
  46.  
  47. factory = PackagesRegistry
  48.