コード例 #1
0
ファイル: database.py プロジェクト: Roromis/SynApps
 def _get_installed_application_cfg_infos(self, id):
     repository = u''
     
     try:
         cfg = ConfigParser()
         cfg.read(['./cache/installed/' + id + '/appinfo.ini', './cache/installed/' + id + '/installer.ini'])
         
         root = os.path.join(self.get_config('rootpath'), cfg.get('Framakey', 'ApplicationRoot', 'Apps/%s' % id))
         if os.path.exists(root):
             size_u = get_size(root)
         else:
             logger.debug(u"L'application %s n'est plus installée, suppression des fichiers de cache." % id)
             shutil.rmtree('./cache/installed/' + id)
             return None, None, None
         
         try:
             branch = cfg.get('Framakey', 'Branch')
         except NoOptionError:       # Rétrocompatibilité
             branch = cfg.get('Framakey', 'Repository')
         category = cfg.get('Details', 'Category')
         name = cfg.get('Framakey', 'Name')
         friendly_name = cfg.get('Framakey', 'FriendlyName')
         short_description = cfg.get('Details', 'Description')
         long_description = cfg.get('Framakey', 'LongDesc')
         size_c = 0
         
         version = cfg.get('Version', 'PackageVersion')
         license = cfg.get('Framakey', 'License')
         author = cfg.get('Details', 'Publisher')
         show = cfg.getboolean('Framakey', 'Show', True)
         uri = ''
     except (NoSectionError, NoOptionError):
         logger.debug(u"Les informations de l'application %s sont incomplètes." % id)
         return None, None, None
     
     depends = cfg.getlist('Framakey', 'Depend')
     
     links = []
     try:
         links.append(('Fiche Framakey', cfg.get('Details', 'Homepage')))
     except (NoSectionError, NoOptionError):
         pass
     
     try:
         links.append(('Fiche Framasoft', cfg.get('Framakey', 'FramasoftPage')))
     except (NoSectionError, NoOptionError):
         pass
     
     try:
         links.append(('Site Officiel', cfg.get('Framakey', 'AppWebsite')))
     except (NoSectionError, NoOptionError):
         pass
     
     return (id, branch, repository, category, name, friendly_name, 
             short_description, long_description, size_c, size_u, 
             version, license, author, show, uri, 0, -2), links, depends