2020-01-13 15:14:18 +00:00
|
|
|
#!/usr/bin/env python3
|
2017-04-12 13:20:07 +00:00
|
|
|
#
|
|
|
|
# This script is used to generate the list of bugs per compiler version
|
|
|
|
# from the list of bugs.
|
|
|
|
# It updates the list in place and signals failure if there were changes.
|
|
|
|
# This makes it possible to use this script as part of CI to check
|
|
|
|
# that the list is up to date.
|
|
|
|
|
|
|
|
import json
|
|
|
|
import re
|
2022-08-08 13:57:29 +00:00
|
|
|
from pathlib import Path
|
2017-04-12 13:20:07 +00:00
|
|
|
|
|
|
|
def comp(version_string):
|
|
|
|
return [int(c) for c in version_string.split('.')]
|
|
|
|
|
2022-08-08 13:57:29 +00:00
|
|
|
root_path = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
|
|
bugs = json.loads((root_path / 'docs/bugs.json').read_text(encoding='utf8'))
|
2017-04-12 13:20:07 +00:00
|
|
|
|
|
|
|
versions = {}
|
2022-08-08 13:57:29 +00:00
|
|
|
with (root_path / 'Changelog.md').open(encoding='utf8') as changelog:
|
2017-04-12 13:20:07 +00:00
|
|
|
for line in changelog:
|
|
|
|
m = re.search(r'^### (\S+) \((\d+-\d+-\d+)\)$', line)
|
|
|
|
if m:
|
|
|
|
versions[m.group(1)] = {}
|
|
|
|
versions[m.group(1)]['released'] = m.group(2)
|
|
|
|
|
2021-06-30 08:21:41 +00:00
|
|
|
for key, value in versions.items():
|
|
|
|
value['bugs'] = []
|
2017-04-12 13:20:07 +00:00
|
|
|
for bug in bugs:
|
2021-06-30 08:21:41 +00:00
|
|
|
if 'introduced' in bug and comp(bug['introduced']) > comp(key):
|
2017-04-12 13:20:07 +00:00
|
|
|
continue
|
2021-06-30 08:21:41 +00:00
|
|
|
if comp(bug['fixed']) <= comp(key):
|
2017-04-12 13:20:07 +00:00
|
|
|
continue
|
2021-06-30 08:21:41 +00:00
|
|
|
value['bugs'] += [bug['name']]
|
2017-04-12 13:20:07 +00:00
|
|
|
|
2022-08-08 14:19:06 +00:00
|
|
|
(root_path / 'docs/bugs_by_version.json').write_text(json.dumps(
|
|
|
|
versions,
|
|
|
|
sort_keys=True,
|
|
|
|
indent=4,
|
|
|
|
separators=(',', ': ')
|
|
|
|
), encoding='utf8')
|