Summary: Python class library which helps writing Nagios (or Icinga) compatible plugins easily in Python
Summary(pl.UTF-8): Biblioteka klas Pythona pomagająca łatwo pisać wtyczki dla Nagiosa (lub Icingi) w Pythonie
Name: python-%{module}
-Version: 1.2.2
+Version: 1.3.3
Release: 1
License: ZPL 2.1
Group: Libraries/Python
-Source0: https://pypi.python.org/packages/source/n/%{module}/%{module}-%{version}.tar.gz
-# Source0-md5: c85e1641492d606d929b02aa262bf55d
+Source0: https://pypi.debian.net/%{module}/%{module}-%{version}.tar.gz
+# Source0-md5: 7539bf58002fb1285706d91e94dd4e26
URL: nagiosplugin
BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.219
+BuildRequires: rpmbuild(macros) >= 1.710
%if %{with python2}
BuildRequires: python-devel
BuildRequires: python-setuptools
+%if %{with tests}
+BuildRequires: python-pytest
+%endif
%endif
%if %{with python3}
BuildRequires: python3-devel
BuildRequires: python3-modules
BuildRequires: python3-setuptools
+%if %{with tests}
+BuildRequires: python3-pytest
+%endif
%endif
Requires: python-modules
BuildArch: noarch
%prep
%setup -q -n %{module}-%{version}
+install -d examples
+cp -p nagiosplugin/examples/check_*.py examples
+
%build
%if %{with python2}
-%{__python} setup.py build --build-base build-2 %{?with_tests:test}
+%py_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+%{__python} -m pytest tests
+%endif
%endif
%if %{with python3}
-%{__python3} setup.py build --build-base build-3 %{?with_tests:test}
+%py3_build
+
+%if %{with tests}
+%{__python3} -m pytest tests
+%endif
%endif
%if %{with doc}
rm -rf $RPM_BUILD_ROOT
%if %{with python2}
-%{__python} setup.py \
- build --build-base build-2 \
- install --skip-build \
- --optimize=2 \
- --root=$RPM_BUILD_ROOT
+%py_install
%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/%{module}/examples
-%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/%{module}/tests
-
%py_postclean
+
+install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
+cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
%endif
%if %{with python3}
-%{__python3} setup.py \
- build --build-base build-3 \
- install --skip-build \
- --optimize=2 \
- --root=$RPM_BUILD_ROOT
+%py3_install
%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/%{module}/examples
-%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/%{module}/tests
+
+install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
+cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
%endif
%clean
%doc HACKING.txt CONTRIBUTORS.txt HISTORY.txt README.txt
%{py_sitescriptdir}/%{module}
%{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
+%{_examplesdir}/python-%{module}-%{version}
%endif
%if %{with python3}
%doc HACKING.txt CONTRIBUTORS.txt HISTORY.txt README.txt
%{py3_sitescriptdir}/%{module}
%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
+%{_examplesdir}/python3-%{module}-%{version}
%endif
%if %{with doc}