diff options
Diffstat (limited to 'src/jarabe')
-rw-r--r-- | src/jarabe/journal/journalactivity.py | 7 | ||||
-rw-r--r-- | src/jarabe/model/bundleregistry.py | 17 |
2 files changed, 19 insertions, 5 deletions
diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py index 4f4d320..4ca751c 100644 --- a/src/jarabe/journal/journalactivity.py +++ b/src/jarabe/journal/journalactivity.py @@ -277,12 +277,13 @@ class JournalActivity(Window): return if registry.is_installed(bundle): + logging.debug('_check_for_bundle bundle already installed') return try: registry.install(bundle) - except (ZipExtractException, RegistrationException), e: - logging.warning('Could not install bundle %s: %r' % - (bundle.get_path(), e)) + except (ZipExtractException, RegistrationException): + logging.warning('Could not install bundle %s:\n%s' % \ + (bundle.get_path(), traceback.format_exc())) return if metadata['mime_type'] == JournalEntryBundle.MIME_TYPE: diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py index ee440a5..57db287 100644 --- a/src/jarabe/model/bundleregistry.py +++ b/src/jarabe/model/bundleregistry.py @@ -208,7 +208,7 @@ class BundleRegistry(gobject.GObject): ''.join(traceback.format_exception(*sys.exc_info())))) return None - if self.get_bundle(bundle.get_bundle_id()) is not None: + if self.is_installed(bundle): return None self._bundles.append(bundle) @@ -305,13 +305,26 @@ class BundleRegistry(gobject.GObject): open(path, 'w').write(cjson.encode(favorites_data)) def is_installed(self, bundle): - return self.get_bundle(bundle.get_bundle_id()) is not None + 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(): + return True + return False def install(self, bundle): activities_path = env.get_user_activities_path() if self.is_installed(bundle): raise AlreadyInstalledException + 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(): + raise AlreadyInstalledException + elif bundle.get_bundle_id() == installed_bundle.get_bundle_id(): + self.uninstall(installed_bundle, force=True) + install_dir = env.get_user_activities_path() install_path = bundle.install(install_dir) |