libvirt/scripts/meson-html-gen.py
Peter Krempa c2aca70777 scripts/meson-html-gen.py: Don't rereformat output files
The output HTML files (especially those generated from rST files) don't
look good even after reformatting. Skip the extra step and accept that
no matter what we do HTMLs will not look great.

This additionally makes it way simpler to remove meson-html-gen.py in
the future (thus I've neglected to remove passing of xmllint).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2020-10-19 12:40:50 +02:00

31 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("xsltproc", type=str, help="path to xsltproc bin")
parser.add_argument("xmllint", type=str, help="path to xmllint bin")
parser.add_argument("builddir", type=str, help="build root dir path")
parser.add_argument("timestamp", type=str, help="docs timestamp")
parser.add_argument("style", type=str, help="XSL stile file")
parser.add_argument("infile", type=str, help="path to source HTML file")
parser.add_argument("htmlfile", type=str, help="path to generated HTML file")
parser.add_argument("pagesrc", type=str, default="", nargs='?', help="(optional) path to source file used for edit this page")
args = parser.parse_args()
html = subprocess.run(
[
args.xsltproc,
'--stringparam', 'pagesrc', args.pagesrc,
'--stringparam', 'builddir', args.builddir,
'--stringparam', 'timestamp', args.timestamp,
'--nonet', args.style, args.infile,
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
with open(args.htmlfile, 'wb') as outfile:
outfile.write(html.stdout)