mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
update_bugs_by_version: Use pathlib
This commit is contained in:
parent
abe869ad7c
commit
c1cbffc814
@ -6,20 +6,20 @@
|
|||||||
# This makes it possible to use this script as part of CI to check
|
# This makes it possible to use this script as part of CI to check
|
||||||
# that the list is up to date.
|
# that the list is up to date.
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
def comp(version_string):
|
def comp(version_string):
|
||||||
return [int(c) for c in version_string.split('.')]
|
return [int(c) for c in version_string.split('.')]
|
||||||
|
|
||||||
path = os.path.dirname(os.path.realpath(__file__))
|
root_path = Path(__file__).resolve().parent.parent
|
||||||
with open(path + '/../docs/bugs.json', encoding='utf8') as bugsFile:
|
|
||||||
bugs = json.load(bugsFile)
|
bugs = json.loads((root_path / 'docs/bugs.json').read_text(encoding='utf8'))
|
||||||
|
|
||||||
versions = {}
|
versions = {}
|
||||||
with open(path + '/../Changelog.md', encoding='utf8') as changelog:
|
with (root_path / 'Changelog.md').open(encoding='utf8') as changelog:
|
||||||
for line in changelog:
|
for line in changelog:
|
||||||
m = re.search(r'^### (\S+) \((\d+-\d+-\d+)\)$', line)
|
m = re.search(r'^### (\S+) \((\d+-\d+-\d+)\)$', line)
|
||||||
if m:
|
if m:
|
||||||
@ -36,8 +36,6 @@ for key, value in versions.items():
|
|||||||
value['bugs'] += [bug['name']]
|
value['bugs'] += [bug['name']]
|
||||||
|
|
||||||
new_contents = json.dumps(versions, sort_keys=True, indent=4, separators=(',', ': '))
|
new_contents = json.dumps(versions, sort_keys=True, indent=4, separators=(',', ': '))
|
||||||
with open(path + '/../docs/bugs_by_version.json', 'r', encoding='utf8') as bugs_by_version:
|
old_contents = (root_path / 'docs/bugs_by_version.json').read_text(encoding='utf8')
|
||||||
old_contents = bugs_by_version.read()
|
(root_path / 'docs/bugs_by_version.json').write_text(new_contents, encoding='utf8')
|
||||||
with open(path + '/../docs/bugs_by_version.json', 'w', encoding='utf8') as bugs_by_version:
|
|
||||||
bugs_by_version.write(new_contents)
|
|
||||||
sys.exit(old_contents != new_contents)
|
sys.exit(old_contents != new_contents)
|
||||||
|
Loading…
Reference in New Issue
Block a user