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 / Ubuntu.pyc (.txt) < prev   
Encoding:
Python Compiled Bytecode  |  2009-10-12  |  6.6 KB  |  138 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import Default
  5. 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
  6. from AppInstall.Util import *
  7. import datetime
  8. import locale
  9. from gettext import gettext as _
  10.  
  11. class Distribution(Default.Distribution):
  12.     
  13.     def __init__(self):
  14.         Default.Distribution.__init__(self)
  15.         self.filters_primary = {
  16.             SHOW_ALL: (_('All available applications'), ''),
  17.             SHOW_ONLY_FREE: (_('All Open Source applications'), '') }
  18.         self.filters_secondary = {
  19.             SHOW_ONLY_SUPPORTED: (_('Canonical-maintained applications'), ''),
  20.             SHOW_ONLY_THIRD_PARTY: (_('Third party applications'), '') }
  21.         self.components_ask = [
  22.             'universe',
  23.             'multiverse']
  24.         self.components_activation = {
  25.             None: [
  26.                 _('Enable the installation of software from the %s component of Ubuntu?'),
  27.                 _('%s is not officially supported with security updates.')],
  28.             'main': [
  29.                 _('Enable the installaion of officially supported Ubuntu software?'),
  30.                 _('%s is part of the Ubuntu main distribution. Canonical Ltd. provides support and security updates, which will be enabled too.')],
  31.             'universe': [
  32.                 _('Enable the installation of community maintained software?'),
  33.                 _('%s is maintained by the Ubuntu community. The Ubuntu community provides support and security updates, which will be enabled too.')],
  34.             'multiverse': [
  35.                 _('Enable the installation of unsupported and restricted software?'),
  36.                 _('The use, modification and distribution of %s is restricted by copyright or by legal terms in some countries.')] }
  37.         self.dependencies_map = [
  38.             (('kdelibs5', 'python-kde4', 'libqtgui4'), None, 'application-kde'),
  39.             (('libgnome2-0', 'python-gnome2', 'libgtk2.0-0', 'python-gtk2'), None, 'application-gnome'),
  40.             (('libxfce4util4',), None, None)]
  41.         self.comp_depend_map = {
  42.             'universe': [
  43.                 'main'],
  44.             'multiverse': [
  45.                 'main',
  46.                 'universe'] }
  47.  
  48.     
  49.     def get_app_emblems(self, app, cache):
  50.         emblems = []
  51.         icon_name = None
  52.         tooltip = None
  53.         if app.channel.endswith('-partner') and app.supported:
  54.             tooltip = _('%s is provided by a third party vendor from the Canonical partner repository.') % app.name
  55.             icon_name = 'application-partner'
  56.             emblems.append((icon_name, tooltip))
  57.         elif app.component == 'main' or app.supported:
  58.             tooltip = _('Canonical Ltd. provides technical support and security updates for %s') % app.name
  59.             icon_name = 'application-supported'
  60.             emblems.append((icon_name, tooltip))
  61.         elif app.thirdparty or app.channel:
  62.             tooltip = '%s is provided by a third party vendor and is therefore not an official part of Ubuntu. The third party vendor is responsible for support and security updates.' % app.name
  63.             icon_name = 'application-proprietary'
  64.             emblems.append((icon_name, tooltip))
  65.         
  66.         if app.component == 'universe':
  67.             tooltip = _('This application is provided by the Ubuntu community.')
  68.             icon_name = 'application-community'
  69.             emblems.append((icon_name, tooltip))
  70.         
  71.         if app.component == 'multiverse' or app.thirdparty:
  72.             tooltip = _('The use, modification and distribution of %s is restricted by copyright or by legal terms in some countries.') % app.name
  73.             icon_name = 'application-proprietary'
  74.             emblems.append((icon_name, tooltip))
  75.         
  76.         if cache.has_key(app.pkgname):
  77.             for deps, tooltip, icon_name in self.dependencies_map:
  78.                 for dep in deps:
  79.                     if cache.pkgDependsOn(app.pkgname, dep):
  80.                         if type(tooltip) == str:
  81.                             tooltip = tooltip % app.name
  82.                         
  83.                         emblems.append((icon_name, tooltip))
  84.                         break
  85.                         continue
  86.                 
  87.             
  88.         
  89.         return emblems
  90.  
  91.     
  92.     def get_codec_information_link(self):
  93.         url = 'https://codecs.canonical.com'
  94.         label = _('Buy Licensed Plug-ins...')
  95.         return (label, url)
  96.  
  97.     
  98.     def get_maintenance_status(self, app, cache):
  99.         releasef = get_release_filename_for_pkg(cache, app.pkgname, 'Ubuntu', self.get_codename())
  100.         time_t = get_release_date_from_release_file(releasef)
  101.         if time_t:
  102.             release_date = datetime.datetime.fromtimestamp(time_t)
  103.             now = datetime.datetime.now()
  104.             release_age = (now - release_date).days
  105.             (support_end_year, support_end_month) = get_maintenance_end_date(release_date, 18)
  106.             support_end_month_str = locale.nl_langinfo(getattr(locale, 'MON_%d' % support_end_month))
  107.             if now.year >= support_end_year:
  108.                 pass
  109.             support_ended = now.month > support_end_month
  110.             if app.component == 'main':
  111.                 if support_ended:
  112.                     return _('Canonical does no longer provide updates for %s in Ubuntu %s. Updates may be available in a newer version of Ubuntu.') % (app.name, self.get_distro_release())
  113.                 return _('Canonical provides critical updates for %(appname)s until %(support_end_month_str)s %(support_end_year)s.') % {
  114.                     'appname': app.name,
  115.                     'support_end_month_str': support_end_month_str,
  116.                     'support_end_year': support_end_year }
  117.             app.component == 'main'
  118.             if app.component == 'restricted':
  119.                 if support_ended:
  120.                     return _('Canonical does no longer provide updates for %s in Ubuntu %s. Updates may be available in a newer version of Ubuntu.') % (app.name, self.get_distro_release())
  121.                 return _('Canonical provides critical updates supplied by the developers of %(appname)s until %(support_end_month_str)s %(support_end_year)s.') % {
  122.                     'appname': app.name,
  123.                     'support_end_month_str': support_end_month_str,
  124.                     'support_end_year': support_end_year }
  125.             app.component == 'restricted'
  126.         
  127.         if app.thirdparty or app.channel:
  128.             return _('Canonical does not provide updates for %s. Some updates may be provided by the third party vendor.') % app.name
  129.         if app.component == 'main':
  130.             return _('Canonical provides critical updates for %s.') % app.name
  131.         if app.component == 'restricted':
  132.             return _('Canonical provides critical updates supplied by the developers of %s.') % app.name
  133.         if app.component == 'universe' or app.component == 'multiverse':
  134.             return _('Canonical does not provide updates for %s. Some updates may be provided by the Ubuntu community.') % app.name
  135.         return _('Application %s has a unkown maintenance status.') % app.name
  136.  
  137.  
  138.