hurl/bin/release/changelog_extract.py

30 lines
679 B
Python
Raw Normal View History

2022-11-02 21:01:49 +03:00
#!/usr/bin/env python3
2022-12-07 11:10:05 +03:00
# bin/release/changelog_extract.py 1.8.0
2022-11-02 21:01:49 +03:00
import sys
2022-12-07 11:10:05 +03:00
def extract(changelog_file, version):
2022-11-02 21:01:49 +03:00
print_line = False
2022-12-07 11:10:05 +03:00
for line in open(changelog_file).readlines():
2022-11-02 21:01:49 +03:00
if "CHANGELOG" in line and line.startswith("["):
if line[1:].startswith(version):
print_line = True
else:
print_line = False
if print_line:
print(line.rstrip())
def main():
if len(sys.argv) < 2:
print("usage:")
2022-12-07 11:10:05 +03:00
print(" bin/release/changelog_extract.py 1.8.0")
2022-11-02 21:01:49 +03:00
sys.exit(1)
version = sys.argv[1]
2022-12-07 11:10:05 +03:00
extract("CHANGELOG.md", version)
2022-11-02 21:01:49 +03:00
if __name__ == "__main__":
main()