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

Ticket #2425: 0001-Adopt-to-new-numbering-scheme-2425.patch

File 0001-Adopt-to-new-numbering-scheme-2425.patch, 3.8 KB (added by erikos, 3 years ago)

New patch for the shell (activity list, bundleregistry)

  • src/jarabe/desktop/activitieslist.py

    From 6dd457e879b3426db500e548bd351fca20392d91 Mon Sep 17 00:00:00 2001
    From: Simon Schampijer <simon@schampijer.de>
    Date: Thu, 28 Oct 2010 09:38:11 +0200
    Subject: [PATCH] Adopt to new numbering scheme #2425
    
    - the activities list view is changed to use a string for the version
    - the comparisons in the bundleregistry is changed to use the new
    numbering scheme
    ---
     src/jarabe/desktop/activitieslist.py |    2 +-
     src/jarabe/model/bundleregistry.py   |   17 ++++++++++-------
     2 files changed, 11 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..329a121 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) < \ 
     161                        NormalizedVersion(bundle.get_activity_version()): 
    160162                    max_version = bundle.get_activity_version() 
    161163 
    162164            key = self._get_favorite_key(bundle_id, max_version) 
    163             if max_version > -1 and key not in self._favorite_bundles: 
     165            if NormalizedVersion(max_version) > NormalizedVersion('0') and \ 
     166                    key not in self._favorite_bundles: 
    164167                self._favorite_bundles[key] = None 
    165168 
    166169        logging.debug('After merging: %r', self._favorite_bundles) 
     
    243246        installed = self.get_bundle(bundle_id) 
    244247 
    245248        if installed is not None: 
    246             if installed.get_activity_version() >= \ 
    247                     bundle.get_activity_version(): 
     249            if NormalizedVersion(installed.get_activity_version()) >= \ 
     250                    NormalizedVersion(bundle.get_activity_version()): 
    248251                logging.debug('Skip old version for %s', bundle_id) 
    249252                return None 
    250253            else: 
     
    378381 
    379382        for installed_bundle in self._bundles: 
    380383            if bundle.get_bundle_id() == installed_bundle.get_bundle_id() and \ 
    381                     bundle.get_activity_version() <= \ 
    382                         installed_bundle.get_activity_version(): 
     384                    NormalizedVersion(bundle.get_activity_version()) <= \ 
     385                        NormalizedVersion(installed_bundle.get_activity_version()): 
    383386                raise AlreadyInstalledException 
    384387            elif bundle.get_bundle_id() == installed_bundle.get_bundle_id(): 
    385388                self.uninstall(installed_bundle, force=True)