]> git.pld-linux.org Git - packages/python-nagiosplugin.git/blobdiff - python-nagiosplugin.spec
Up to 1.3.3
[packages/python-nagiosplugin.git] / python-nagiosplugin.spec
index 99c0657576ab6f57874da22883575c708bedb557..c43b093adea1992013c89f0e2f10c41f806ed712 100644 (file)
 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
@@ -73,13 +79,25 @@ Dokumentacja API %{module}.
 %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}
@@ -92,27 +110,22 @@ rm -rf _build/html/_sources
 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
@@ -124,6 +137,7 @@ rm -rf $RPM_BUILD_ROOT
 %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}
@@ -132,6 +146,7 @@ rm -rf $RPM_BUILD_ROOT
 %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}
This page took 0.080242 seconds and 4 git commands to generate.