gnome-shell/meson/generate-manpages.py
Florian Müllner 9ef9a5ff8a build: Pre-generate man pages at dist time
The man pages don't change very often, but draw in both docbook and
asciidoc. The latter is particularly problematic, as some distros
still ship only a python2 version of the tool.

Address this by generating the man pages at dist time, and including
the result in the tarball.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1553>
2020-12-28 02:25:24 +01:00

25 lines
654 B
Python

#!/usr/bin/env python3
import os
from pathlib import PurePath
from asciidocapi import AsciiDocAPI
man_pages = [
'man/gnome-shell.1',
'subprojects/extensions-tool/man/gnome-extensions.1',
]
sourceroot = os.environ.get('MESON_SOURCE_ROOT')
distroot = os.environ.get('MESON_DIST_ROOT')
asciidoc = AsciiDocAPI()
for man_page in man_pages:
page_path = PurePath(man_page)
src = PurePath(sourceroot, page_path.with_suffix('.txt'))
dst = PurePath(distroot, page_path)
stylesheet = src.with_name('stylesheet.xsl')
asciidoc.options('--xsl-file', os.fspath(stylesheet))
asciidoc.execute(os.fspath(src), outfile=os.fspath(dst))