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)
|
-
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
|
|
| 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..329a121 100644
|
a
|
b
|
|
| 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 |
| … |
… |
|
| 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) < \ |
| | 161 | NormalizedVersion(bundle.get_activity_version()): |
| 160 | 162 | max_version = bundle.get_activity_version() |
| 161 | 163 | |
| 162 | 164 | 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: |
| 164 | 167 | self._favorite_bundles[key] = None |
| 165 | 168 | |
| 166 | 169 | logging.debug('After merging: %r', self._favorite_bundles) |
| … |
… |
|
| 243 | 246 | installed = self.get_bundle(bundle_id) |
| 244 | 247 | |
| 245 | 248 | 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()): |
| 248 | 251 | logging.debug('Skip old version for %s', bundle_id) |
| 249 | 252 | return None |
| 250 | 253 | else: |
| … |
… |
|
| 378 | 381 | |
| 379 | 382 | for installed_bundle in self._bundles: |
| 380 | 383 | 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()): |
| 383 | 386 | raise AlreadyInstalledException |
| 384 | 387 | elif bundle.get_bundle_id() == installed_bundle.get_bundle_id(): |
| 385 | 388 | self.uninstall(installed_bundle, force=True) |
Download in other formats: