From 6a462a3f6037c3d3ce021aadd856ef819d10e74d Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Fri, 25 Oct 2024 14:48:27 +0200 Subject: [PATCH] meson: add man pages Signed-off-by: Pavel Hrdina --- .gitignore | 5 ----- man/meson.build | 18 ++++++++++++++++++ meson.build | 4 ++++ setup.py | 28 ---------------------------- 4 files changed, 22 insertions(+), 33 deletions(-) create mode 100644 man/meson.build diff --git a/.gitignore b/.gitignore index b9a048957..bafdaad4a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,9 +10,4 @@ /data/gschemas.compiled -/man/virt-manager.1 -/man/virt-install.1 -/man/virt-clone.1 -/man/virt-xml.1 - /virtinst/build.cfg diff --git a/man/meson.build b/man/meson.build new file mode 100644 index 000000000..990fe8d8b --- /dev/null +++ b/man/meson.build @@ -0,0 +1,18 @@ +rst_files = files( + 'virt-install.rst', + 'virt-clone.rst', + 'virt-xml.rst', + 'virt-manager.rst', +) + +rst2man_prog = find_program(['rst2man', 'rst2man.py'], required: true) + +foreach rst_file : rst_files + man_page = custom_target( + input: rst_file, + output: '@BASENAME@.1', + command: [ rst2man_prog, '--strict', '@INPUT@', '@OUTPUT@'], + install: true, + install_dir: datadir / 'man' / 'man1', + ) +endforeach diff --git a/meson.build b/meson.build index 40e36874c..c0daed2c1 100644 --- a/meson.build +++ b/meson.build @@ -6,10 +6,14 @@ project('virt-manager', python = import('python') python3 = python.find_installation('python3') +prefix = get_option('prefix') +datadir = prefix / get_option('datadir') + # figure out if we are building from git git = run_command('test', '-e', '.git', check: false).returncode() == 0 subdir('scripts') +subdir('man') if git spec_conf = configuration_data({ diff --git a/setup.py b/setup.py index b43e72a83..44b675fdb 100755 --- a/setup.py +++ b/setup.py @@ -160,26 +160,6 @@ from %(pkgname)s import %(filename)s make_script("virtManager", "virtmanager", "virt-manager") - def _make_man_pages(self): - rstbin = shutil.which("rst2man") - if not rstbin: - rstbin = shutil.which("rst2man.py") - if not rstbin: - sys.exit("Didn't find rst2man or rst2man.py") - - for path in glob.glob("man/*.rst"): - base = os.path.basename(path) - appname = os.path.splitext(base)[0] - newpath = os.path.join(os.path.dirname(path), - appname + ".1") - - print("Generating %s" % newpath) - out = subprocess.check_output([rstbin, "--strict", path]) - open(newpath, "wb").write(out) - - self.distribution.data_files.append( - ('share/man/man1', (newpath,))) - def _build_icons(self): for size in glob.glob(os.path.join("data/icons", "*")): for category in glob.glob(os.path.join(size, "*")): @@ -221,7 +201,6 @@ from %(pkgname)s import %(filename)s def run(self): self._make_bin_wrappers() - self._make_man_pages() self._build_icons() self._make_bash_completion_files() @@ -499,13 +478,6 @@ setuptools.setup( ["data/org.virt-manager.virt-manager.gschema.xml"]), ("share/virt-manager/ui", glob.glob("ui/*.ui")), - ("share/man/man1", [ - "man/virt-manager.1", - "man/virt-install.1", - "man/virt-clone.1", - "man/virt-xml.1" - ]), - ("share/virt-manager/virtManager", glob.glob("virtManager/*.py")), ("share/virt-manager/virtManager/details", glob.glob("virtManager/details/*.py")),