Ticket #1720: 0001-ignore-logging-cleanup-fail-sugarlabs.org-1720-lapto.patch

File 0001-ignore-logging-cleanup-fail-sugarlabs.org-1720-lapto.patch, 2.0 KB (added by quozl, 14 years ago)

patch for review

  • bin/sugar-session

    From f35d0978963c83c932313d552e400ae486b99138 Mon Sep 17 00:00:00 2001
    From: James Cameron <quozl@laptop.org>
    Date: Thu, 11 Feb 2010 13:39:42 +1100
    Subject: [PATCH] ignore logging cleanup fail, sugarlabs.org #1720 laptop.org #9623
    
    	reinstates a design feature that was in sugar-session last year
    	that was removed during rework.
    ---
     bin/sugar-session |   13 +++++++++----
     1 files changed, 9 insertions(+), 4 deletions(-)
    
    diff --git a/bin/sugar-session b/bin/sugar-session
    index 471d878..0c3fbcd 100644
    a b def cleanup_logs(): 
    7272        if os.path.isfile(path):
    7373            backup_logs.append(f)
    7474        elif os.path.isdir(path):
    75             backup_dirs.append(path)   
     75            backup_dirs.append(path)
    7676
    7777    if len(backup_dirs) > 3:
    7878        backup_dirs.sort()
    def setup_keyboard_cb(): 
    161161        for layout in layouts:
    162162            layouts_list.append(layout.split('(')[0])
    163163            variants_list.append(layout.split('(')[1][:-1])
    164        
     164
    165165        if layouts_list is not None and layouts_list is not [] \
    166166                and variants_list is not None and variants_list is not []:
    167167            configrec.set_layouts(layouts_list)
    def setup_keyboard_cb(): 
    175175        options = gconf_client.get_list(\
    176176            '/desktop/sugar/peripherals/keyboard/options', gconf.VALUE_STRING)
    177177        if options is not [] and options is not None:
    178             configrec.set_options(options)       
     178            configrec.set_options(options)
    179179
    180180        configrec.activate(engine)
    181181    except Exception:
    def set_fonts(): 
    214214    settings.set_property("gtk-font-name", "%s %f" % (face, size))
    215215
    216216def main():
    217     cleanup_logs()
     217    try:
     218        cleanup_logs()
     219    except OSError, e:
     220        # logs cleanup is not critical; it should not prevent sugar from
     221        # starting if (for example) the disk is full or read-only.
     222        print 'logs cleanup failed: %s' % e
    218223    logger.start('shell')
    219224
    220225    client = gconf.client_get_default()