summaryrefslogtreecommitdiff
path: root/changelog.py
blob: ac41e304eff8c53ead6c27d7aa49754cc9b7c1e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3

import os, subprocess
from pathlib import Path

changelog_path = Path(
    os.getenv('MESON_DIST_ROOT')
    or os.getenv('MESON_SOURCE_ROOT')
    or Path(__file__).parent
) / 'ChangeLog'

print('Writing changelog to {path}'.format(path=changelog_path))

with open(changelog_path, 'w') as changelog_file:
    changelog = subprocess.check_output([
        'git', 'log',
        '--no-color',
        '--find-renames',
        '--find-copies',
        '--name-status'
    ]).decode()
    changelog_file.write(changelog)