Attachments you submit will be routed for moderation. If you have an account, please log in first.

Ticket #2425: 0001-Changes-to-use-a-activity-version-with-a-dotted-sche.patch

File 0001-Changes-to-use-a-activity-version-with-a-dotted-sche.patch, 3.7 KB (added by godiard, 3 years ago)
  • src/jarabe/desktop/activitieslist.py

    From 43cc914889ec9580c8c136afa9fd54636a340ad0 Mon Sep 17 00:00:00 2001
    From: Gonzalo Odiard <godiard@sugarlabs.org>
    Date: Thu, 7 Oct 2010 17:29:44 -0300
    Subject: [PATCH] Changes to use a activity version with a dotted schema
    
    ---
     src/jarabe/desktop/activitieslist.py |    2 +-
     src/jarabe/model/bundleregistry.py   |   16 +++++++++-------
     2 files changed, 10 insertions(+), 8 deletions(-)
    
    diff --git a/src/jarabe/desktop/activitieslist.py b/src/jarabe/desktop/activitieslist.py
    index 56b3b5f..1d42282 100644
    a b  
    167167    COLUMN_DATE_TEXT = 7 
    168168 
    169169    def __init__(self): 
    170         self._model = gtk.ListStore(str, bool, str, str, int, str, int, str) 
     170        self._model = gtk.ListStore(str, bool, str, str, str, str, int, str) 
    171171        self._model_filter = self._model.filter_new() 
    172172        gtk.TreeModelSort.__init__(self, self._model_filter) 
    173173 
  • src/jarabe/model/bundleregistry.py

    diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py
    index 699e339..cda838d 100644
    a b  
    2626 
    2727from sugar.bundle.activitybundle import ActivityBundle 
    2828from sugar.bundle.contentbundle import ContentBundle 
     29from sugar.bundle.bundleversion import NormalizedVersion 
    2930from jarabe.journal.journalentrybundle import JournalEntryBundle 
    3031from sugar.bundle.bundle import MalformedBundleException, \ 
    3132    AlreadyInstalledException, RegistrationException 
     
    153154            return 
    154155 
    155156        for bundle_id in default_activities: 
    156             max_version = -1 
     157            max_version = '0' 
    157158            for bundle in self._bundles: 
    158159                if bundle.get_bundle_id() == bundle_id and \ 
    159                         max_version < bundle.get_activity_version(): 
     160                        NormalizedVersion(max_version) < NormalizedVersion(bundle.get_activity_version()): 
    160161                    max_version = bundle.get_activity_version() 
    161162 
    162163            key = self._get_favorite_key(bundle_id, max_version) 
    163             if max_version > -1 and key not in self._favorite_bundles: 
     164            if NormalizedVersion(max_version) > NormalizedVersion('0') and key not in self._favorite_bundles: 
    164165                self._favorite_bundles[key] = None 
    165166 
    166167        logging.debug('After merging: %r', self._favorite_bundles) 
     
    243244        installed = self.get_bundle(bundle_id) 
    244245 
    245246        if installed is not None: 
    246             if installed.get_activity_version() >= \ 
    247                     bundle.get_activity_version(): 
     247            if NormalizedVersion(installed.get_activity_version()) >= \ 
     248                    NormalizedVersion(bundle.get_activity_version()): 
    248249                logging.debug('Skip old version for %s', bundle_id) 
    249250                return None 
    250251            else: 
     
    378379 
    379380        for installed_bundle in self._bundles: 
    380381            if bundle.get_bundle_id() == installed_bundle.get_bundle_id() and \ 
    381                     bundle.get_activity_version() <= \ 
    382                         installed_bundle.get_activity_version(): 
     382                    NormalizedVersion(bundle.get_activity_version()) <= \ 
     383                        NormalizedVersion(installed_bundle.get_activity_version()): 
     384                logging.error("COMP VERSIONS %s %s" % (bundle.get_activity_version(), installed_bundle.get_activity_version())) 
    383385                raise AlreadyInstalledException 
    384386            elif bundle.get_bundle_id() == installed_bundle.get_bundle_id(): 
    385387                self.uninstall(installed_bundle, force=True)