Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/sugar3/bundle/activitybundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,22 @@ def __init__(self, path, translated=True):

def _parse_info(self, info_file):
cp = ConfigParser()
if six.PY2:
cp.readfp(info_file)
else:
cp.read_file(info_file)

content = info_file.read()
if isinstance(content, bytes):
content = content.decode("utf-8")
try:
if content.startswith("b'") or content.startswith('b"'):
import ast
content = ast.literal_eval(content)
except Exception:
pass

cp.read_string(content, source=getattr(info_file, 'name', '<unknown>'))

section = 'Activity'


if cp.has_option(section, 'bundle_id'):
self._bundle_id = cp.get(section, 'bundle_id')
else:
Expand Down
Loading