Add spanish translator to AUTHORS file
[jack_mixer.git] / docs / meson_dist_rst2man.py
blobbb5e5eff63c4e7e1a5cc4d41939f4f9b43ff9372
1 #!/usr/bin/env python
2 """Create/Update man page(s) from ReST source file(s) to be included in source distribution."""
4 import argparse
5 import shutil
6 import sys
7 from os import chdir, environ, getcwd
8 from os.path import join
10 from subprocess import run
12 build_root = environ.get("MESON_BUILD_ROOT")
13 dist_root = environ.get("MESON_DIST_ROOT")
14 source_root = environ.get("MESON_SOURCE_ROOT")
16 ap = argparse.ArgumentParser()
17 ap.add_argument("-v", "--verbose", action="store_true", help="Be more verbose.")
18 ap.add_argument("man_page", nargs="*", help="Man page(s) to create.")
19 args = ap.parse_args()
21 if args.verbose:
22 print("cwd:", getcwd())
23 print("build root:", build_root)
24 print("dist root:", dist_root)
25 print("source root:", source_root)
26 print("sys.argv:", sys.argv)
28 for man in args.man_page:
29 target = join("docs", man)
30 dst = join(dist_root, "docs", man)
32 print("Creating man page '{}'".format(target))
33 cmd = ["ninja"]
35 if args.verbose:
36 cmd += ["-v"]
38 cmd += [target]
40 chdir(build_root)
41 proc = run(cmd)
43 if proc.returncode != 0:
44 sys.exit("'ninja' returned non-zero ({}) for target '{}'.".format(proc.returncode, target))
46 shutil.copy(target, dst)