Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2010-11-12 10:58:38 (GMT)
committer Simon Schampijer <simon@schampijer.de>2010-11-12 10:58:38 (GMT)
commit15c5850df5b129a9205c96bf8ad2fc91de9d9074 (patch)
treefb94cffc929a98935521c3845ca7e02664c380c7
parent6dd112a6e9c56294fd70b9cf68e9fc8cd83042a1 (diff)
Adapt bundleregistry to use the new activity version scheme #10379
backported changes from SL #2425
-rw-r--r--src/jarabe/model/bundleregistry.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py
index af410a8..1060aff 100644
--- a/src/jarabe/model/bundleregistry.py
+++ b/src/jarabe/model/bundleregistry.py
@@ -27,6 +27,7 @@ import simplejson
from sugar.bundle.activitybundle import ActivityBundle
from sugar.bundle.contentbundle import ContentBundle
from jarabe.journal.journalentrybundle import JournalEntryBundle
+from sugar.bundle.bundleversion import NormalizedVersion
from sugar.bundle.bundle import MalformedBundleException, \
AlreadyInstalledException, RegistrationException
from sugar import env
@@ -141,14 +142,16 @@ class BundleRegistry(gobject.GObject):
return
for bundle_id in default_activities:
- max_version = -1
+ max_version = '0'
for bundle in self._bundles:
if bundle.get_bundle_id() == bundle_id and \
- max_version < bundle.get_activity_version():
+ NormalizedVersion(max_version) < \
+ NormalizedVersion(bundle.get_activity_version()):
max_version = bundle.get_activity_version()
key = self._get_favorite_key(bundle_id, max_version)
- if max_version > -1 and key not in self._favorite_bundles:
+ if NormalizedVersion(max_version) > NormalizedVersion('0') and \
+ key not in self._favorite_bundles:
self._favorite_bundles[key] = None
logging.debug('After merging: %r' % self._favorite_bundles)
@@ -334,8 +337,8 @@ class BundleRegistry(gobject.GObject):
for installed_bundle in self._bundles:
if bundle.get_bundle_id() == installed_bundle.get_bundle_id() and \
- bundle.get_activity_version() == \
- installed_bundle.get_activity_version():
+ NormalizedVersion(bundle.get_activity_version()) == \
+ NormalizedVersion(installed_bundle.get_activity_version()):
return True
return False
@@ -348,8 +351,8 @@ class BundleRegistry(gobject.GObject):
for installed_bundle in self._bundles:
if bundle.get_bundle_id() == installed_bundle.get_bundle_id() and \
- bundle.get_activity_version() == \
- installed_bundle.get_activity_version():
+ NormalizedVersion(bundle.get_activity_version()) <= \
+ NormalizedVersion(installed_bundle.get_activity_version()):
raise AlreadyInstalledException
elif bundle.get_bundle_id() == installed_bundle.get_bundle_id():
self.uninstall(installed_bundle, force=True)
@@ -381,7 +384,8 @@ class BundleRegistry(gobject.GObject):
act = self.get_bundle(bundle.get_bundle_id())
if not force and \
- act.get_activity_version() != bundle.get_activity_version():
+ NormalizedVersion(act.get_activity_version()) != \
+ NormalizedVersion(bundle.get_activity_version()):
logging.warning('Not uninstalling, different bundle present')
return
elif not act.get_path().startswith(env.get_user_activities_path()):