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
|
class ListModel(gtk.TreeModelSort): |
167 | 167 | COLUMN_DATE_TEXT = 7 |
168 | 168 | |
169 | 169 | 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) |
171 | 171 | self._model_filter = self._model.filter_new() |
172 | 172 | gtk.TreeModelSort.__init__(self, self._model_filter) |
173 | 173 | |
diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py
index 699e339..cda838d 100644
a
|
b
|
import simplejson |
26 | 26 | |
27 | 27 | from sugar.bundle.activitybundle import ActivityBundle |
28 | 28 | from sugar.bundle.contentbundle import ContentBundle |
| 29 | from sugar.bundle.bundleversion import NormalizedVersion |
29 | 30 | from jarabe.journal.journalentrybundle import JournalEntryBundle |
30 | 31 | from sugar.bundle.bundle import MalformedBundleException, \ |
31 | 32 | AlreadyInstalledException, RegistrationException |
… |
… |
class BundleRegistry(gobject.GObject): |
153 | 154 | return |
154 | 155 | |
155 | 156 | for bundle_id in default_activities: |
156 | | max_version = -1 |
| 157 | max_version = '0' |
157 | 158 | for bundle in self._bundles: |
158 | 159 | if bundle.get_bundle_id() == bundle_id and \ |
159 | | max_version < bundle.get_activity_version(): |
| 160 | NormalizedVersion(max_version) < NormalizedVersion(bundle.get_activity_version()): |
160 | 161 | max_version = bundle.get_activity_version() |
161 | 162 | |
162 | 163 | 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: |
164 | 165 | self._favorite_bundles[key] = None |
165 | 166 | |
166 | 167 | logging.debug('After merging: %r', self._favorite_bundles) |
… |
… |
class BundleRegistry(gobject.GObject): |
243 | 244 | installed = self.get_bundle(bundle_id) |
244 | 245 | |
245 | 246 | 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()): |
248 | 249 | logging.debug('Skip old version for %s', bundle_id) |
249 | 250 | return None |
250 | 251 | else: |
… |
… |
class BundleRegistry(gobject.GObject): |
378 | 379 | |
379 | 380 | for installed_bundle in self._bundles: |
380 | 381 | 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())) |
383 | 385 | raise AlreadyInstalledException |
384 | 386 | elif bundle.get_bundle_id() == installed_bundle.get_bundle_id(): |
385 | 387 | self.uninstall(installed_bundle, force=True) |