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 <f2016015@pilani.bits-pilani.ac.in>
This commit is contained in:
James Cameron 2018-02-15 14:52:55 +11:00
parent 7e216a04d5
commit cc2357c787

View File

@ -143,7 +143,7 @@ class ActivityBundle(Bundle):
'changed to bundle_id') 'changed to bundle_id')
else: else:
raise MalformedBundleException( raise MalformedBundleException(
'Activity bundle %s does not specify a bundle id' % 'Activity bundle %s does not specify a bundle_id' %
self.get_path()) self.get_path())
if ' ' in self._bundle_id: if ' ' in self._bundle_id:
@ -182,6 +182,10 @@ class ActivityBundle(Bundle):
if cp.has_option(section, 'icon'): if cp.has_option(section, 'icon'):
self._icon = cp.get(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'): if cp.has_option(section, 'activity_version'):
version = cp.get(section, 'activity_version') version = cp.get(section, 'activity_version')
@ -192,6 +196,10 @@ class ActivityBundle(Bundle):
'Activity bundle %s has invalid version number %s' % 'Activity bundle %s has invalid version number %s' %
(self.get_path(), version)) (self.get_path(), version))
self._activity_version = 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'): if cp.has_option(section, 'summary'):
self._summary = cp.get(section, 'summary') self._summary = cp.get(section, 'summary')
@ -211,6 +219,11 @@ class ActivityBundle(Bundle):
'Activity bundle %s has invalid max_participants %s' % 'Activity bundle %s has invalid max_participants %s' %
(self.get_path(), max_participants)) (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): def _get_linfo_file(self):
# Using method from gettext.py, first find languages from environ # Using method from gettext.py, first find languages from environ
languages = [] languages = []