From 74122f1631605a0c3148911a48876ac09a780d83 Mon Sep 17 00:00:00 2001 From: lrossett Date: Apr 08 2021 18:32:27 +0000 Subject: adding manpage support --- diff --git a/centpkg.spec b/centpkg.spec index c67802e..e91a344 100644 --- a/centpkg.spec +++ b/centpkg.spec @@ -37,6 +37,7 @@ Requires: python-six %else BuildRequires: python3-devel BuildRequires: python3-setuptools +BuildRequires: python3-rpkg %endif @@ -59,10 +60,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 mv src/centpkg.bash %{buildroot}%{compdir}/centpkg @@ -85,6 +91,7 @@ mv src/centpkg.bash %{buildroot}%{compdir}/centpkg %changelog * Thur Apr 08 2021 Leonardo Rossetti - 0.5.1-3 - Add bash completion support +- 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..edae454 --- /dev/null +++ b/doc/centpkg_man_page.py @@ -0,0 +1,24 @@ +# 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 + except ImportError: + sys.path.append('src/') + import centpkg + 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')