1
0
mirror of https://github.com/certbot/certbot.git synced 2025-08-02 07:26:35 +03:00
Files
certbot/tools/extract_changelog.py
Yuma Mihira d3ca6af982 Insert new line before "More details about these changes can be found on our GitHub repo." (#8645)
Fixing #8634. It's my first time contributing to this repository, if there's something wrong please let me know.

Before this fix

```
$ python3 extract_changelog.py 1.12.0
...
### Fixed
* Fixed the apache component on openSUSE Tumbleweed which no longer provides
  an apache2ctl symlink and uses apachectl instead.
* Fixed a typo in `certbot/crypto_util.py` causing an error upon attempting `secp521r1` key generation
More details about these changes can be found on our GitHub repo.
```

After this fix

```
$ python3 extract_changelog.py 1.12.0
...
### Fixed
* Fixed the apache component on openSUSE Tumbleweed which no longer provides
  an apache2ctl symlink and uses apachectl instead.
* Fixed a typo in `certbot/crypto_util.py` causing an error upon attempting `secp521r1` key generation

More details about these changes can be found on our GitHub repo.
```
2021-02-25 16:30:48 -08:00

40 lines
929 B
Python
Executable File

#!/usr/bin/env python
from __future__ import print_function
import os
import re
import sys
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('.', '\\.')))
with open(os.path.join(CERTBOT_ROOT, 'certbot', 'CHANGELOG.md')) as file_h:
lines = file_h.read().splitlines()
changelog = []
i = 0
while i < len(lines):
if section_pattern.match(lines[i]):
i = i + 2
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()