This commit is contained in:
Sam Parkinson 2016-07-16 08:00:42 +10:00
commit 67874842c0
No known key found for this signature in database
GPG Key ID: 34E268B2FA2F8B13

View File

@ -143,7 +143,7 @@ class ActivityBundle(Bundle):
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._path) self.get_path())
if ' ' in self._bundle_id: if ' ' in self._bundle_id:
raise MalformedBundleException('Space in bundle_id') raise MalformedBundleException('Space in bundle_id')
@ -152,7 +152,7 @@ class ActivityBundle(Bundle):
self._name = cp.get(section, 'name') self._name = cp.get(section, 'name')
else: else:
raise MalformedBundleException( raise MalformedBundleException(
'Activity bundle %s does not specify a name' % self._path) 'Activity bundle %s does not specify a name' % self.get_path())
if cp.has_option(section, 'exec'): if cp.has_option(section, 'exec'):
self.bundle_exec = cp.get(section, 'exec') self.bundle_exec = cp.get(section, 'exec')
@ -165,7 +165,7 @@ class ActivityBundle(Bundle):
'changed to exec') 'changed to exec')
else: else:
raise MalformedBundleException( raise MalformedBundleException(
'Activity bundle %s must specify exec' % self._path) 'Activity bundle %s must specify exec' % self.get_path())
if cp.has_option(section, 'mime_types'): if cp.has_option(section, 'mime_types'):
mime_list = cp.get(section, 'mime_types').strip(';') mime_list = cp.get(section, 'mime_types').strip(';')
@ -189,7 +189,7 @@ class ActivityBundle(Bundle):
except InvalidVersionError: except InvalidVersionError:
raise MalformedBundleException( raise MalformedBundleException(
'Activity bundle %s has invalid version number %s' % 'Activity bundle %s has invalid version number %s' %
(self._path, version)) (self.get_path(), version))
self._activity_version = version self._activity_version = version
if cp.has_option(section, 'summary'): if cp.has_option(section, 'summary'):
@ -206,7 +206,7 @@ class ActivityBundle(Bundle):
except ValueError: except ValueError:
raise MalformedBundleException( raise MalformedBundleException(
'Activity bundle %s has invalid max_participants %s' % 'Activity bundle %s has invalid max_participants %s' %
(self._path, max_participants)) (self.get_path(), max_participants))
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
@ -255,13 +255,13 @@ class ActivityBundle(Bundle):
"""Get the locale path inside the (installed) activity bundle.""" """Get the locale path inside the (installed) activity bundle."""
if self._zip_file is not None: if self._zip_file is not None:
raise NotInstalledException raise NotInstalledException
return os.path.join(self._path, 'locale') return os.path.join(self.get_path(), 'locale')
def get_icons_path(self): def get_icons_path(self):
"""Get the icons path inside the (installed) activity bundle.""" """Get the icons path inside the (installed) activity bundle."""
if self._zip_file is not None: if self._zip_file is not None:
raise NotInstalledException raise NotInstalledException
return os.path.join(self._path, 'icons') return os.path.join(self.get_path(), 'icons')
def get_name(self): def get_name(self):
"""Get the activity user-visible name.""" """Get the activity user-visible name."""
@ -277,7 +277,7 @@ class ActivityBundle(Bundle):
# we don't need to create a temp file in the zip case # we don't need to create a temp file in the zip case
icon_path = os.path.join('activity', self._icon + '.svg') icon_path = os.path.join('activity', self._icon + '.svg')
if self._zip_file is None: if self._zip_file is None:
return os.path.join(self._path, icon_path) return os.path.join(self.get_path(), icon_path)
else: else:
icon_data = self.get_file(icon_path).read() icon_data = self.get_file(icon_path).read()
temp_file, temp_file_path = tempfile.mkstemp(prefix=self._icon, temp_file, temp_file_path = tempfile.mkstemp(prefix=self._icon,