From 96c739f98e81241a6ee2e7127af398a238a79d67 Mon Sep 17 00:00:00 2001 From: Nils <> Date: Sun, 12 Apr 2020 23:20:45 +0200 Subject: [PATCH] generate manpage and install it --- template/Makefile.in | 7 +++-- template/documentation/build.py | 47 ++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/template/Makefile.in b/template/Makefile.in index c1c2be3..7b6fbbf 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -48,7 +48,7 @@ gitclean: resources: cd template/documentation && python3 build.py cd documentation && sh build-documentation.sh - cd qtgui/resources && sh buildresources.sh + cd qtgui/resources && sh buildresources.sh install: install -D -m 755 $(PROGRAM).bin $(DESTDIR)$(PREFIX)/bin/$(PROGRAM) @@ -58,7 +58,10 @@ install: install -D -m 644 LICENSE $(DESTDIR)$(PREFIX)/share/doc/$(PROGRAM)/LICENSE install -D -m 644 desktop/desktop.desktop $(DESTDIR)$(PREFIX)/share/applications/$(PROGRAM).desktop - + + gzip -c documentation/$(PROGRAM).1 > $(DESTDIR)$(PREFIX)/share/man/man1/$(PROGRAM).1.gz + + #Icons for size in 16 32 64 128 256 512 ; do \ install -D -m 644 desktop/images/"$$size"x"$$size".png $(DESTDIR)$(PREFIX)/share/icons/hicolor/"$$size"x"$$size"/apps/$(PROGRAM).png ; \ diff --git a/template/documentation/build.py b/template/documentation/build.py index 2eaf7ec..dce1709 100644 --- a/template/documentation/build.py +++ b/template/documentation/build.py @@ -19,7 +19,7 @@ The correct out/ dir is already part of git. import sys sys.path.append("../../engine") from config import METADATA -from subprocess import run +import subprocess from os import getcwd import os.path assert os.path.exists(os.path.join(getcwd(), __file__)), (getcwd(), __file__) @@ -85,5 +85,50 @@ for language in METADATA["supportedLanguages"].keys(): with open (f"../../documentation/{language}.adoc", "w") as w: w.write(template) + +#Create manpage +#Needs help2man +manpage_template = f""" +[name] +{METADATA["name"]} - {METADATA["tagline"]} + +[usage] +{METADATA["description"]} + +[Reporting bugs] +https://www.laborejo.org/bugs + +[copyright] +{METADATA["name"]} {METADATA["version"]} - Copyright {METADATA["year"]} +{METADATA["author"]} +https://www.laborejo.org/ + +[examples] +Start {METADATA["shortName"]} through NSM, e.g. through Argodejo. This will take care of all +settings and save directories. + +Other modes of operations, mostly for testing, are: + +Run without session management and save in /tmp. + {METADATA["shortName"]} --save /tmp + +Run without audio and midi. Skips all JACK checks. Used to just look at the GUI, e.g. to make screenshots + {METADATA["shortName"]} --mute + +[see also] +The full documentation for {METADATA["name"]} is maintained as a multi-lingual html site to your systems doc-dir. +For example: + xdg-open file:///usr/share/doc/{METADATA["shortName"]}/index.html + +The documentation can also be found online https://www.laborejo.org/documentation/{METADATA["shortName"]} +""" + +with open ("../../documentation/manpageinclude.h2m", "w") as w: + w.write(manpage_template) + +command = f"help2man ../../{METADATA['shortName']} --no-info --include ../../documentation/manpageinclude.h2m > ../../documentation/{METADATA['shortName']}.1" +subprocess.run(command, capture_output=True, text=True, shell=True) + + #print ("Built /documentation. You still need to run /documentation/build-documentation.sh manually") print ("Built template part of documentation.")