1#!/usr/bin/env python3
2
3# External command, intended to be called with meson.add_dist_script() in meson.build
4
5#                       argv[1]
6# dist-changelog.py <root_source_dir>
7
8import os
9import sys
10import subprocess
11
12# Make a ChangeLog file for distribution.
13cmd = [
14  'git',
15  '--git-dir=' + os.path.join(sys.argv[1], '.git'),
16  '--work-tree=' + sys.argv[1],
17  'log',
18  '--no-merges',
19  '--date=short',
20  '--max-count=200',
21  '--pretty=tformat:%cd  %an  <%ae>%n%n  %s%n%w(0,0,2)%+b',
22]
23with open(os.path.join(os.getenv('MESON_DIST_ROOT'), 'ChangeLog'), mode='w') as logfile:
24  sys.exit(subprocess.run(cmd, stdout=logfile).returncode)
25