[Sugar-devel] [PATCH] Adopt Updater to new activity version scheme
Walter Bender
walter.bender at gmail.com
Wed Nov 10 16:37:31 EST 2010
On Mon, Nov 8, 2010 at 11:45 AM, Simon Schampijer <simon at schampijer.de> wrote:
> ---
> extensions/cpsection/updater/backends/aslo.py | 9 ++++++---
> extensions/cpsection/updater/model.py | 4 +++-
> extensions/cpsection/updater/view.py | 2 +-
> 3 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/extensions/cpsection/updater/backends/aslo.py b/extensions/cpsection/updater/backends/aslo.py
> index 5f257f9..3d63406 100644
> --- a/extensions/cpsection/updater/backends/aslo.py
> +++ b/extensions/cpsection/updater/backends/aslo.py
> @@ -54,6 +54,9 @@ import traceback
>
> import gio
>
> +from sugar.bundle.bundleversion import NormalizedVersion
> +from sugar.bundle.bundleversion import InvalidVersionError
> +
> from jarabe import config
>
> _FIND_DESCRIPTION = \
> @@ -127,10 +130,10 @@ class _UpdateFetcher(object):
> size = None
> else:
> try:
> - version = int(document.find(_FIND_VERSION).text)
> - except ValueError:
> + version = NormalizedVersion(document.find(_FIND_VERSION).text)
> + except InvalidVersionError:
> logging.error(traceback.format_exc())
> - version = 0
> + version = '0'
>
> link = document.find(_FIND_LINK).text
>
> diff --git a/extensions/cpsection/updater/model.py b/extensions/cpsection/updater/model.py
> index 9845371..d58e3bc 100755
> --- a/extensions/cpsection/updater/model.py
> +++ b/extensions/cpsection/updater/model.py
> @@ -33,6 +33,7 @@ import gio
> from sugar import env
> from sugar.datastore import datastore
> from sugar.bundle.activitybundle import ActivityBundle
> +from sugar.bundle.bundleversion import NormalizedVersion
>
> from jarabe.model import bundleregistry
>
> @@ -83,7 +84,8 @@ class UpdateModel(gobject.GObject):
> logging.error('Error getting update information from server:\n'
> '%s' % error_message)
>
> - if version is not None and version > bundle.get_activity_version():
> + if version is not None and \
> + version > NormalizedVersion(bundle.get_activity_version()):
> self.updates.append(BundleUpdate(bundle, version, link, size))
>
> if self._cancelling:
> diff --git a/extensions/cpsection/updater/view.py b/extensions/cpsection/updater/view.py
> index 2164c0b..ce853fb 100644
> --- a/extensions/cpsection/updater/view.py
> +++ b/extensions/cpsection/updater/view.py
> @@ -359,7 +359,7 @@ class UpdateListModel(gtk.ListStore):
> row[self.SELECTED] = True
> row[self.ICON_FILE_NAME] = bundle_update.bundle.get_icon()
>
> - details = _('From version %(current)d to %(new)s (Size: %(size)s)')
> + details = _('From version %(current)s to %(new)s (Size: %(size)s)')
> details = details % \
> {'current': bundle_update.bundle.get_activity_version(),
> 'new': bundle_update.version,
> --
> 1.7.2.3
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
I am getting this error from sugar-jhbuild built today (Nov 10):
File "/home/walter/Desktop/sugar-jhbuild/install/lib/python2.7/site-packages/jarabe/model/bundleregistry.py",
line 29, in <module>
from sugar.bundle.bundleversion import NormalizedVersion
ImportError: No module named bundleversion
Window manager warning: Fatal IO error 11 (Resource temporarily
unavailable) on display ':30'.
I suspect that it is related to your recent patch.
-walter
--
Walter Bender
Sugar Labs
http://www.sugarlabs.org
More information about the Sugar-devel
mailing list