Make it easier to reason about state transitions
[tails.git] / bin / update-changelog
blob15e60ccf68c2728435b5fa3931417646551834e7
1 #! /usr/bin/python3
3 import argparse
4 import debian.changelog
5 import subprocess
7 parser = argparse.ArgumentParser()
8 parser.add_argument('--version', required=True)
9 args = parser.parse_args()
11 with open('debian/changelog', 'r') as f:
12     changelog = debian.changelog.Changelog(f)
13     # Remove the placeholder entry for the next release
14     changelog._blocks = changelog._blocks[1:]
15     changelog_minus_first_entry = changelog
17 with open('debian/changelog', 'w') as f:
18     f.write(subprocess.check_output(
19         ['bin/generate-changelog', '--version', args.version]
20     ).decode('utf-8'))
21     changelog_minus_first_entry.write_to_open_file(f)