enhancement: package the CLI frontend

This commit is contained in:
Satoru SATOH 2019-02-24 19:49:55 +09:00
parent 7f2ea0b007
commit d35cfdb68a
2 changed files with 22 additions and 3 deletions

View file

@ -51,6 +51,24 @@ Requires: python2-chardet
%py3_build
%else
%py2_build
# Dirty hacks.
test -d %{buildroot}%{python_sitelib}/%{pkgname} || {
cp -a src/%{pkgname} %{buildroot}%{python_sitelib}/
}
test -d %{buildroot}/usr/bin || {
install -d %{buildroot}/usr/bin
cat << EOF > %{buildroot}/usr/bin/smhtml_cli
#! /usr/bin/python
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('smhtml', 'console_scripts', 'smhtml_cli')()
)
EOF
}
chmod +x %{buildroot}/usr/bin/smhtml_cli
%endif
%install
@ -68,6 +86,7 @@ Requires: python2-chardet
%{python_sitelib}/%{pkgname}*
%endif
%doc README.rst
%{_bindir}/*
%changelog
* Sun Feb 24 2019 Satoru SATOH <ssato@redhat.com> - 0.0.1-1

View file

@ -45,6 +45,6 @@ exclude =
tests
tests.*
#[options.entry_points]
#console_scripts =
# smhtml_cli = smhtml.cli:main
[options.entry_points]
console_scripts =
smhtml_cli = smhtml.cli:main