Blob Blame History Raw
%{?python_enable_dependency_generator}

%global modname vpoller
%global sum     Distributed vSphere API Proxy

Name:           python-%{modname}
Version:        0.7.3
Release:        3%{?dist}
Summary:        %{sum}

# setup.py mentions BSD license
License:        BSD
URL:            https://github.com/dnaeon/py-%{modname}
# hint: pypi misses several files but github provides
Source0:        %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz

BuildArch:      noarch

%global _description \
vPoller is a distributed VMware vSphere API Proxy,\
designed for discovering and polling of vSphere objects.\
\
It uses the VMware vSphere API in order to perform discovery\
and polling of vSphere objects.\
\
vPoller uses the ZeroMQ messaging library for distributing\
tasks to workers and load balancing of client requests.\
\
vPoller can be integrated with other systems, which require\
access to vSphere objects, but do not have native support\
for it.\
\
Possible scenarios where vPoller could be used is integration\
with monitoring systems as part of the discovery and polling\
process in order to provide monitoring of your VMware vSphere\
environment.

%description
%{_description}

%package     -n python%{python3_pkgversion}-%{modname}
Summary:        %{sum}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{modname}}
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-setuptools
#BuildRequires: %%{py3_dist docopt zmq vconnector pyvmomi sphinx}
BuildRequires:  python%{python3_pkgversion}-docopt
BuildRequires:  python%{python3_pkgversion}-zmq
BuildRequires:  python%{python3_pkgversion}-vconnector
BuildRequires:  python%{python3_pkgversion}-pyvmomi
# no magic dependencies in epel
%if %{undefined __pythondist_requires}
Requires:       python%{python3_pkgversion}-pyvmomi
Requires:       python%{python3_pkgversion}-vconnector
Requires:       python%{python3_pkgversion}-zmq
Requires:       python%{python3_pkgversion}-docopt
%endif

%description -n python%{python3_pkgversion}-%{modname}
%{_description}

%package     -n %{modname}
Summary:        Executable binaries for %{sum}
BuildRequires:  help2man
Requires:       python%{python3_pkgversion}-%{modname}

%description -n %{modname}
%{_description}
This pacakge installs the executable binaries.

%package        doc
Summary:        Documentation files for %{sum}
BuildRequires:  python%{python3_pkgversion}-sphinx

%description    doc
%{_description}
This pacakge installs several documentation files.

%prep
%autosetup -npy-%{modname}-%{version}

%build
%py3_build
export PYTHONPATH=../src
sed -i -r \
 -e 's:(SPHINXBUILD.*=).*:\1 %{_bindir}/sphinx-build-%{python3_version}:' \
 -e 's:SPHINXOPTS.*=:\0 %{_smp_mflags} :' \
 docs/Makefile
%make_build -C docs html
rm -rf docs/_build/html/.{doctrees,buildinfo}
# wrong-script-interpreter
grep -rl "/usr/bin/env" | xargs chmod 0644
grep -rl "/usr/bin/env" | xargs sed -i "s|#!/usr/bin/env |/usr/bin/|"

%install
%py3_install
# manpages
pushd %{buildroot}
install -d .%{_mandir}/man1
for suffix in client proxy worker ; do
PYTHONPATH=.%{python3_sitelib} help2man --no-discard-stderr \
 -o .%{_mandir}/man1/%{modname}-${suffix}.1 .%{_bindir}/%{modname}-${suffix}
done
popd


%files -n python%{python3_pkgversion}-%{modname}
%license LICENSE
%doc README.rst AUTHORS.txt
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-%{version}-py%{python3_version}.egg-info/

%files -n %{modname}
%license LICENSE
%{_bindir}/%{modname}-*
%{_mandir}/man1/%{modname}-*.1*

%files doc
%license LICENSE
%doc docs/_build/html/
%doc contrib/ extra/


%changelog
* Sun May 19 2019 Raphael Groner <projects.rg@smart.ms> - 0.7.3-3
- use concrete python3 version and path for sphinx-build

* Sun Apr 14 2019 Raphael Groner <projects.rg@smart.ms> - 0.7.3-2
- split subpackages for doc and bin
- move BR into subpackages

* Wed Apr 10 2019 Raphael Groner <projects.rg@smart.ms> - 0.7.3-1
- new version
- drop upstreamed license patch
- generate manpages
- fix rpmlint

* Sat Jan 26 2019 Raphael Groner <projects.rg@smart.ms> - 0.7.1-1
- initial