2019-10-30 13:19:10 -04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
from __future__ import print_function
|
2019-12-09 15:50:20 -05:00
|
|
|
|
2019-10-30 13:19:10 -04:00
|
|
|
import os
|
|
|
|
|
import re
|
2019-12-09 15:50:20 -05:00
|
|
|
import sys
|
2019-10-30 13:19:10 -04:00
|
|
|
|
|
|
|
|
CERTBOT_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
|
|
|
|
|
|
|
|
|
NEW_SECTION_PATTERN = re.compile(r'^##\s*[\d.]+\s*-\s*[\d-]+$')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
version = sys.argv[1]
|
|
|
|
|
|
|
|
|
|
section_pattern = re.compile(r'^##\s*{0}\s*-\s*[\d-]+$'
|
|
|
|
|
.format(version.replace('.', '\\.')))
|
|
|
|
|
|
2019-11-25 21:24:20 -05:00
|
|
|
with open(os.path.join(CERTBOT_ROOT, 'certbot', 'CHANGELOG.md')) as file_h:
|
2019-10-30 13:19:10 -04:00
|
|
|
lines = file_h.read().splitlines()
|
|
|
|
|
|
|
|
|
|
changelog = []
|
|
|
|
|
|
|
|
|
|
i = 0
|
|
|
|
|
while i < len(lines):
|
|
|
|
|
if section_pattern.match(lines[i]):
|
2021-02-25 19:30:48 -05:00
|
|
|
i = i + 2
|
2019-10-30 13:19:10 -04:00
|
|
|
while i < len(lines):
|
|
|
|
|
if NEW_SECTION_PATTERN.match(lines[i]):
|
|
|
|
|
break
|
|
|
|
|
changelog.append(lines[i])
|
|
|
|
|
i = i + 1
|
|
|
|
|
i = i + 1
|
|
|
|
|
|
|
|
|
|
print('\n'.join(changelog))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
main()
|