File size: 677 Bytes
2c17839 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #!/usr/bin/env python
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import argparse
from pathlib import Path
parser = argparse.ArgumentParser()
parser.add_argument("--version")
args = parser.parse_args()
with open("CHANGELOG.md", "r") as f:
text = f.read()
output = []
for line in text.splitlines():
if line.startswith("### "):
if args.version == line[3:].strip():
found = True
elif found:
break
else:
if found:
output.append(line)
build_dir = Path("build")
with open(build_dir / "CHANGELOG.md", "w") as f:
f.write("\n".join(output))
|