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
|
||||
# that the list is up to date.
|
||||
|
||||
import os
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
def comp(version_string):
|
||||
return [int(c) for c in version_string.split('.')]
|
||||
|
||||
path = os.path.dirname(os.path.realpath(__file__))
|
||||
with open(path + '/../docs/bugs.json', encoding='utf8') as bugsFile:
|
||||
bugs = json.load(bugsFile)
|
||||
root_path = Path(__file__).resolve().parent.parent
|
||||
|
||||
bugs = json.loads((root_path / 'docs/bugs.json').read_text(encoding='utf8'))
|
||||
|
||||
versions = {}
|
||||
with open(path + '/../Changelog.md', encoding='utf8') as changelog:
|
||||
with (root_path / 'Changelog.md').open(encoding='utf8') as changelog:
|
||||
for line in changelog:
|
||||
m = re.search(r'^### (\S+) \((\d+-\d+-\d+)\)$', line)
|
||||
if m:
|
||||
@ -36,8 +36,6 @@ for key, value in versions.items():
|
||||
value['bugs'] += [bug['name']]
|
||||
|
||||
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 = bugs_by_version.read()
|
||||
with open(path + '/../docs/bugs_by_version.json', 'w', encoding='utf8') as bugs_by_version:
|
||||
bugs_by_version.write(new_contents)
|
||||
old_contents = (root_path / 'docs/bugs_by_version.json').read_text(encoding='utf8')
|
||||
(root_path / 'docs/bugs_by_version.json').write_text(new_contents, encoding='utf8')
|
||||
sys.exit(old_contents != new_contents)
|
||||
|
Loading…
Reference in New Issue
Block a user