Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
192 - 1
"""
2
Copyright 2012-2019 VMware, Inc.  All rights reserved. -- VMware Confidential
3
"""
4
import shutil
5
 
6
def UpdateIconCache(inst, DATADIR):
7
   """ Updates the Gtk+ icon cache """
8
   icons = DATADIR/'icons/hicolor'
9
 
10
   # Signal icon update
11
   inst.RunCommand('touch', '-m', icons, ignoreErrors=True)
12
 
13
   # Ubuntu doesn't seem to do this by default
14
   # It also causes gnome-panel 2.16.x or lower to freeze,
15
   # but is fixed in GTK+ 2.10.13/gnome-panel 2.18.0
16
   # Original bug report: http://bugzilla.gnome.org/show_bug.cgi?id=426987
17
   # Check to make sure we're running a new enough version before doing this
18
   updateCache = True
19
   panelPath = shutil.which('gnome-panel')
20
   if panelPath != None and panelPath != '':
21
      panelres = inst.RunCommand('gnome-panel', '--version')
22
      match = re.search(r'\d+(\.\d+)+', panelres.stdout)
23
      versions = inst.LoadInclude('versions')
24
      if match and versions.CompareVersionString(match.group(), '2.18') < 0:
25
         log.Info(u'Buggy version of gnome-panel found, not updating icon cache')
26
         updateCache = False
27
 
28
   if updateCache:
29
      if inst.RunCommand('gtk-update-icon-cache', '--force', '--quiet', icons,
30
                         ignoreErrors=True).retCode != 0:
31
         log.Error(u'Unable to update icon cache')
32
 
33
def UpdateMIME(inst, DATADIR):
34
   """ Updates the MIME database """
35
   if inst.RunCommand('update-mime-database', DATADIR/'mime',
36
                      ignoreErrors=True).retCode != 0:
37
      log.Error('Unable to update MIME database')
38
   if inst.RunCommand('update-desktop-database', DATADIR/'applications',
39
                      ignoreErrors=True).retCode != 0:
40
      log.Error('Unable to update Desktop database')