adding manpage support

This commit is contained in:
lrossett 2021-04-08 11:07:52 -03:00 committed by Carl George
parent 3bff023602
commit 74122f1631
2 changed files with 31 additions and 0 deletions

View file

@ -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 <lrossett@redhat.com> - 0.5.1-3
- Add bash completion support
- Add manpage support
* Thu Mar 25 2021 Carl George <carl@george.computer> - 0.5.1-2
- Add missing el7 requirements

24
doc/centpkg_man_page.py Normal file
View file

@ -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')