From cc2357c787cb30d02e1568a2bf23dc18c367468f Mon Sep 17 00:00:00 2001 From: James Cameron Date: Thu, 15 Feb 2018 14:52:55 +1100 Subject: [PATCH] Add warnings for missing activity metadata - report a warning if either activity_version, icon, or license are missing, - fix typo in missing bundle_id exception message. Fixes #378 Co-authored-by: Rahul Bothra --- src/sugar3/bundle/activitybundle.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/sugar3/bundle/activitybundle.py b/src/sugar3/bundle/activitybundle.py index 522503d0..c0d9d985 100644 --- a/src/sugar3/bundle/activitybundle.py +++ b/src/sugar3/bundle/activitybundle.py @@ -143,7 +143,7 @@ class ActivityBundle(Bundle): 'changed to bundle_id') else: raise MalformedBundleException( - 'Activity bundle %s does not specify a bundle id' % + 'Activity bundle %s does not specify a bundle_id' % self.get_path()) if ' ' in self._bundle_id: @@ -182,6 +182,10 @@ class ActivityBundle(Bundle): if cp.has_option(section, 'icon'): self._icon = cp.get(section, 'icon') + else: + logging.warning( + 'Activity bundle %s does not specify an icon' % + self.get_path()) if cp.has_option(section, 'activity_version'): version = cp.get(section, 'activity_version') @@ -192,6 +196,10 @@ class ActivityBundle(Bundle): 'Activity bundle %s has invalid version number %s' % (self.get_path(), version)) self._activity_version = version + else: + logging.warning( + 'Activity bundle %s does not specify an activity_version, ' + 'assuming %s' % (self.get_path(), self._activity_version)) if cp.has_option(section, 'summary'): self._summary = cp.get(section, 'summary') @@ -211,6 +219,11 @@ class ActivityBundle(Bundle): 'Activity bundle %s has invalid max_participants %s' % (self.get_path(), max_participants)) + if not cp.has_option(section, 'license'): + logging.warning( + 'Activity bundle %s does not specify a license' % + self.get_path()) + def _get_linfo_file(self): # Using method from gettext.py, first find languages from environ languages = []