home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / dist-packages / AppInstall / distros / Default.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-10-12  |  4.0 KB  |  95 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from AppInstall.Menu import SHOW_ALL, SHOW_ONLY_SUPPORTED, SHOW_ONLY_FREE, SHOW_ONLY_MAIN, SHOW_ONLY_PROPRIETARY, SHOW_ONLY_THIRD_PARTY, SHOW_ONLY_INSTALLED
  5. from gettext import gettext as _
  6. import subprocess
  7.  
  8. class Distribution(object):
  9.     
  10.     def __init__(self):
  11.         self.filters_primary = {
  12.             SHOW_ALL: (_('All available applications'), _('Show all applications including ones which are unsupported and possibly restricted by law or copyright')) }
  13.         self.filters_secondary = { }
  14.         self.components_ask = []
  15.         self.components_activation = {
  16.             None: [
  17.                 _('Enable the installation of software from the %s component of Ubuntu?'),
  18.                 _('%s is not officially supported with security updates.')] }
  19.         self.dependencies_map = []
  20.         self.comp_depend_map = { }
  21.  
  22.     
  23.     def get_components_ask(self):
  24.         '''
  25.         Returns a list of components whose applications should not be installed
  26.         before asking for a confirmation
  27.         '''
  28.         return self.components_ask
  29.  
  30.     
  31.     def get_codec_information_link(self):
  32.         '''
  33.         Returns a link and a description to additional codec releated
  34.         information or possibilities, e.g. a link to a petition against
  35.         software patents or a shop to purchase codecs, just as the distro
  36.         pleases
  37.         '''
  38.         return (None, None)
  39.  
  40.     
  41.     def get_components_ask_msgs(self):
  42.         '''
  43.         Returns a dictonary that provides dialog messages that are shown,
  44.         before a component gets activated or when it requires to be confirmed
  45.         '''
  46.         return self.components_activation
  47.  
  48.     
  49.     def get_codename(self):
  50.         '''
  51.         Return the distribution codename of the current running distro
  52.         as returned by lsb_release
  53.         '''
  54.         if not hasattr(self, 'codename'):
  55.             self.codename = subprocess.Popen([
  56.                 'lsb_release',
  57.                 '-c',
  58.                 '-s'], stdout = subprocess.PIPE).communicate()[0].strip()
  59.         
  60.         return self.codename
  61.  
  62.     
  63.     def get_distro_release(self):
  64.         '''
  65.         Return the distribution release of the current running distro
  66.         as returned by lsb_release
  67.         '''
  68.         if not hasattr(self, 'distro_release'):
  69.             self.distro_release = subprocess.Popen([
  70.                 'lsb_release',
  71.                 '-r',
  72.                 '-s'], stdout = subprocess.PIPE).communicate()[0].strip()
  73.         
  74.         return self.distro_release
  75.  
  76.     
  77.     def get_maintaince_status(self, app, cache):
  78.         ''' 
  79.         return a string that gives information about the mainainance
  80.         status of the the given app
  81.         '''
  82.         return ''
  83.  
  84.     
  85.     def get_comp_dependencies(self, comp):
  86.         if self.comp_depend_map.has_key(comp):
  87.             return self.comp_depend_map[comp]
  88.         return []
  89.  
  90.  
  91. if __name__ == '__main__':
  92.     d = Distribution()
  93.     print "code: '%s'" % d.get_codename()
  94.  
  95.