Skip to content

Commit cd5e291

Browse files
committed
Removing utf_16 changelog attempt
1 parent cbc033b commit cd5e291

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

src/windows/about.py

+15-20
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,21 @@ def parse_changelog(changelog_path):
5353
if not os.path.exists(changelog_path):
5454
return None
5555
changelog_list = None
56-
for encoding_name in ('utf_8', 'utf_16'):
57-
try:
58-
with codecs.open(changelog_path, 'r', encoding=encoding_name) as changelog_file:
59-
# Generate match object with fields from all matching lines
60-
matches = re.findall(r"(\w{6,10})\s+(\d{4}-\d{2}-\d{2})\s+(.*)\s{2,99}?(.*)",
61-
changelog_file.read(), re.MULTILINE)
62-
log.debug("Parsed {} changelog lines from {}".format(len(matches), changelog_path))
63-
changelog_list = [{
64-
"hash": entry[0].strip(),
65-
"date": entry[1].strip(),
66-
"author": entry[2].strip(),
67-
"subject": entry[3].strip(),
68-
} for entry in matches]
69-
break
70-
except UnicodeError:
71-
log.debug('Failed to parse log file %s with encoding %s' % (changelog_path, encoding_name))
72-
continue
73-
except Exception:
74-
log.warning("Parse error reading {}".format(changelog_path), exc_info=1)
75-
return None
56+
try:
57+
with codecs.open(changelog_path, 'r', encoding='utf_8') as changelog_file:
58+
# Generate match object with fields from all matching lines
59+
matches = re.findall(r"(\w{6,10})\s+(\d{4}-\d{2}-\d{2})\s+(.*)\s{2,99}?(.*)",
60+
changelog_file.read(), re.MULTILINE)
61+
log.debug("Parsed {} changelog lines from {}".format(len(matches), changelog_path))
62+
changelog_list = [{
63+
"hash": entry[0].strip(),
64+
"date": entry[1].strip(),
65+
"author": entry[2].strip(),
66+
"subject": entry[3].strip(),
67+
} for entry in matches]
68+
except Exception:
69+
log.warning("Parse error reading {}".format(changelog_path), exc_info=1)
70+
return None
7671
return changelog_list
7772

7873

0 commit comments

Comments
 (0)