From 6ae0e1a4c01baf1bf12df3b9e016bb50d973ad4e Mon Sep 17 00:00:00 2001 From: Stuart Prescott Date: Mon, 16 Feb 2026 18:54:52 +1100 Subject: [PATCH] Add some help2man for man pages --- debian/control | 1 + debian/make-manpages | 101 ++++++++++++++++++++++++++++++++++ debian/pyside6-tools.manpages | 19 +++++++ debian/rules | 5 +- 4 files changed, 125 insertions(+), 1 deletion(-) create mode 100755 debian/make-manpages create mode 100644 debian/pyside6-tools.manpages diff --git a/debian/control b/debian/control index 9042db5c..625bf2ca 100644 --- a/debian/control +++ b/debian/control @@ -13,6 +13,7 @@ Build-Depends: dh-sequence-python3, dh-sequence-sphinxdoc, furo , + help2man, libclang-dev, libxml2-dev, libxslt1-dev, diff --git a/debian/make-manpages b/debian/make-manpages new file mode 100755 index 00000000..b0eea78e --- /dev/null +++ b/debian/make-manpages @@ -0,0 +1,101 @@ +#!/usr/bin/python3 + +import os +from pathlib import Path +import subprocess +import textwrap + + +skip_tools = [ + "android-deploy", + "assistant", + "balsamui", + "designer", + "linguist", + "qmlimportscanner", +] + + +def help2man(tool): + toolname = str(tool.stem).replace("pyside6-", "") + if toolname in skip_tools: + print(f"I: skipping {toolname} as configured") + return + + print(f"I: attempting to make man page for {toolname} ({tool})") + _run_help2man(tool, toolname, "--help") + + +def _run_help2man(tool, toolname, help_opt): + cmd = [ + "xvfb-run", + "--auto-servernum", + "help2man", + "--name", + toolname, + "--section", + "1", + "--manual", + "PySide6 tools", + "--help-option", + help_opt, + "--version-string", + pyside_version, + "--no-info", # suppress "see info pages" footer + "--output", + str(mandir / (tool.stem + ".1")), + str(tool), + ] + cmd_summary = [ + f"LD_LIBRARY_PATH={env["LD_LIBRARY_PATH"]} ", + f"PYTHONPATH={env["PYTHONPATH"]} ", + "'", + "' '".join(cmd), + "'", + ] + print(f"I: {''.join(cmd_summary)}") + + # Run the tool + ret = subprocess.run(cmd, capture_output=True, timeout=10, encoding="UTF-8", env=env) + if ret.returncode != 0: + print(f"W: returned: {ret.returncode}:\n") + print(textwrap.indent(ret.stdout, "W: ")) + print(textwrap.indent(ret.stderr, "W: ")) + + +# PATH CONFIG FOR TOOL +wd = Path.cwd() + +# In preparation for debhelper, debian/tmp will be used for most operations +# except for the list of tools, which we get from those installed into the +# pyside6-tools package +tmppath = wd / "debian" / "tmp" +modpath = list((tmppath / "usr" / "lib").glob("python*"))[0] / "dist-packages" +bindir = wd / "debian" / "pyside6-tools" / "usr" / "bin" +mandir = tmppath # dh_installman will sort this out for us + +# help2man needs to run the tools but that means that the tools have to be +# able to find libraries / python modules. +libpaths = [ + str(modpath / "shiboken6"), + str(modpath / "PySide6"), +] +if "LD_LIBRARY_PATH" in os.environ: + libpaths.append(os.environ["LD_LIBRARY_PATH"]) +env = { + "LD_LIBRARY_PATH": ":".join(libpaths), + "PYTHONPATH": str(modpath), +} + +# Override the version in all pages (lots of tools don't have a --version +# option to extract the version) +pyside_version = os.environ.get("PYSIDE_MAJOR") +if not pyside_version: + print("W: PySide6 version not available, this should be set in d/rules") + pyside_version = "6" + + +mandir.mkdir(exist_ok=True, parents=True) + +for tool in sorted(bindir.iterdir()): + help2man(tool) diff --git a/debian/pyside6-tools.manpages b/debian/pyside6-tools.manpages new file mode 100644 index 00000000..623f89ea --- /dev/null +++ b/debian/pyside6-tools.manpages @@ -0,0 +1,19 @@ +pyside6-balsam.1 +pyside6-deploy.1 +pyside6-genpyi.1 +pyside6-lrelease.1 +pyside6-lupdate.1 +pyside6-metaobjectdump.1 +pyside6-project.1 +pyside6-qml.1 +pyside6-qmlcachegen.1 +pyside6-qmlformat.1 +pyside6-qmllint.1 +pyside6-qmlls.1 +pyside6-qmltyperegistrar.1 +pyside6-qsb.1 +pyside6-qtpy2cpp.1 +pyside6-rcc.1 +pyside6-svgtoqml.1 +pyside6-uic.1 +shiboken6-genpyi.1 diff --git a/debian/rules b/debian/rules index 5d3e488c..f0bd780f 100755 --- a/debian/rules +++ b/debian/rules @@ -3,7 +3,7 @@ include /usr/share/dpkg/default.mk # Safety measure to ensure package names match SONAMEs -PYSIDE_MAJOR := $(shell echo $(DEB_VERSION_UPSTREAM) | cut -d. -f1-2) +export PYSIDE_MAJOR := $(shell echo $(DEB_VERSION_UPSTREAM) | cut -d. -f1-2) ifeq ($(shell awk '/Package:/ {print $$2}' debian/control | grep -- -$(PYSIDE_MAJOR)$$),) $(error Please update package names for major version $(PYSIDE_MAJOR)) endif @@ -120,6 +120,9 @@ execute_after_dh_install-arch: # fix up various paths in .pc, cmake and __init__.py debian/set-paths + # Make man pages for tools + ./debian/make-manpages + override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) ifeq (mips64el,$(DEB_HOST_ARCH)) -- 2.30.2