From 65468b44ce68f5a265fe1d73a38e9d6284b448c5 Mon Sep 17 00:00:00 2001 From: lrossett Date: Apr 08 2021 14:20:15 +0000 Subject: adding manpage support --- diff --git a/centpkg.spec b/centpkg.spec index 5ab24f5..e9ba233 100644 --- a/centpkg.spec +++ b/centpkg.spec @@ -10,7 +10,7 @@ Name: centpkg Version: 0.5.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: CentOS utility for working with dist-git License: GPLv2+ URL: https://git.centos.org/centos/centpkg @@ -28,9 +28,9 @@ Requires: python-six %else BuildRequires: python3-devel BuildRequires: python3-setuptools +BuildRequires: python3-gitdb %endif - %description Provides the centpkg command for working with dist-git. @@ -50,10 +50,15 @@ Provides the centpkg-sig command for working with dist-git. %build %py_build +%{__python} doc/centpkg_man_page.py > centpkg.1 %install %py_install +%if %{undefined el7} +%{__install} -d %{buildroot}%{_mandir}/man1 +%{__install} -p -m 0644 centpkg.1 %{buildroot}%{_mandir}/man1 +%endif install -D -p -m 0644 src/centpkg.conf %{buildroot}%{_sysconfdir}/rpkg/centpkg.conf install -D -p -m 0644 src/centpkg-sig.conf %{buildroot}%{_sysconfdir}/rpkg/centpkg-sig.conf @@ -73,6 +78,9 @@ install -D -p -m 0644 src/centpkg-sig.conf %{buildroot}%{_sysconfdir}/rpkg/centp %changelog +* Thur Apr 08 2021 Leonardo Rossetti - 0.5.1-3 +- Add manpage support + * Thu Mar 25 2021 Carl George - 0.5.1-2 - Add missing el7 requirements diff --git a/doc/centpkg_man_page.py b/doc/centpkg_man_page.py new file mode 100644 index 0000000..a752812 --- /dev/null +++ b/doc/centpkg_man_page.py @@ -0,0 +1,28 @@ +# Print a man page from the help texts. +import os +import sys + +from six.moves.configparser import ConfigParser + +if __name__ == '__main__': + module_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) + sys.path.insert(0, module_path) + + config = ConfigParser() + config.read( + os.path.join(module_path, 'src', 'centpkg.conf')) + + import pyrpkg.man_gen + try: + import centpkg + from centpkg import cli as centpkg_cli + except ImportError: + sys.path.append('src/') + import centpkg + from centpkg import cli as centpkg_cli + + client = centpkg_cli.centpkgClient(config=config, name='centpkg') + pyrpkg.man_gen.generate(client.parser, + client.subparsers, + identity='centpkg', + sourceurl='https://git.centos.org/centos/centpkg') \ No newline at end of file