diff options
author | Simon Schampijer <simon@schampijer.de> | 2010-11-09 09:53:05 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@schampijer.de> | 2010-11-09 09:53:05 (GMT) |
commit | c7a80a1e56e4f52e280b0b1d87643899726f6c36 (patch) | |
tree | c62550475abc3ad0e1a952c2473eb458377d9c2b /src/sugar/bundle/activitybundle.py | |
parent | d8217d293e13a13dfa0e2ddfee365c14cd85fc2f (diff) |
Add new numbering scheme #2425
- add class NormalizedVersion to parse and compare the new activity versions
- change the bundlebuilder and activitybundle to use the new scheme, instead
of an int version we expect a string that matches the format defined in
NormalizedVersion
Diffstat (limited to 'src/sugar/bundle/activitybundle.py')
-rw-r--r-- | src/sugar/bundle/activitybundle.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/sugar/bundle/activitybundle.py b/src/sugar/bundle/activitybundle.py index 3bbc250..e7882b9 100644 --- a/src/sugar/bundle/activitybundle.py +++ b/src/sugar/bundle/activitybundle.py @@ -32,7 +32,8 @@ from sugar import env from sugar import util from sugar.bundle.bundle import Bundle, \ MalformedBundleException, NotInstalledException - +from sugar.bundle.bundleversion import NormalizedVersion +from sugar.bundle.bundleversion import InvalidVersionError class ActivityBundle(Bundle): """A Sugar activity bundle @@ -59,7 +60,7 @@ class ActivityBundle(Bundle): self._mime_types = None self._show_launcher = True self._tags = None - self._activity_version = 0 + self._activity_version = '0' self._installation_time = os.stat(path).st_mtime self._manifest = None @@ -197,11 +198,12 @@ class ActivityBundle(Bundle): if cp.has_option(section, 'activity_version'): version = cp.get(section, 'activity_version') try: - self._activity_version = int(version) - except ValueError: + NormalizedVersion(version) + except InvalidVersionError: raise MalformedBundleException( 'Activity bundle %s has invalid version number %s' % (self._path, version)) + self._activity_version = version def _get_linfo_file(self): lang = locale.getdefaultlocale()[0] |