File python-nagiosplugin.spec of Package python-nagiosplugin
%global python2_pkgversion 2
%if 0%{?suse_version}
%global python3_pkgversion 3
%global python3_other_pkgversion 0
%if 0%{?suse_version} < 1500
%global __python3 /usr/bin/python3
%global python2_sitelib %{python_sitelib}
%endif
%endif
%if 0%{?fedora_version}
%global python3_pkgversion 3
%global python3_other_pkgversion 0
%endif
%if 0%{?centos_version} == 600 || 0%{?rhel_version} == 600
%global python2_enable 0
%global python3_pkgversion 34
%global python3_other_pkgversion 0
%global __python2 %{__python}
%global python2_sitelib %{python_sitelib}
%global add_license 0
%else
%global python2_enable 1
%global add_license 1
%endif
%if 0%{?centos_version} == 700 || 0%{?rhel_version} == 700
%global __python3 /usr/bin/python3.6
%global __python3_other /usr/bin/python3.4
%global python3_pkgversion 36
%global python3_other_pkgversion 34
%global python3_other_sitelib /usr/lib/python3.4/site-packages
%endif
%if 0%{?centos_version} || 0%{?rhel_version} || 0%{?fedora_version}
# Turn off the brp-python-bytecompile script
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%endif
Name: python-nagiosplugin
Version: 1.3.2
Release: 0
Summary: Class library for writing Nagios (Icinga) plugins
License: ZPL-2.1
Group: Development/Languages/Python
Url: https://nagiosplugin.readthedocs.io/
Source: nagiosplugin-%{version}.tar.gz
BuildArch: noarch
%if 0%{?python2_enable}
BuildRequires: python%{python2_pkgversion}-devel >= 2.7
BuildRequires: python%{python2_pkgversion}-setuptools
%endif
BuildRequires: python%{python3_pkgversion}-devel >= 3.4
BuildRequires: python%{python3_pkgversion}-setuptools
%if 0%{?python3_other_pkgversion}
BuildRequires: python%{python3_other_pkgversion}-devel >= 3.4
BuildRequires: python%{python3_other_pkgversion}-setuptools
%endif
%if 0%{?suse_version}
BuildRequires: fdupes
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
nagiosplugin is a Python class library which helps writing Nagios (or
Icinga) compatible plugins in Python. It cares for much of the
boilerplate code and default logic commonly found in Nagios checks,
including:
- Nagios 3 Plugin API compliant parameters and output formatting
- Full Nagios range syntax support
- Automatic threshold checking
- Multiple independent measures
- Custom status line to communicate the main point quickly
- Long output and performance data
- Timeout handling
- Persistent "cookies" to retain state information between check runs
- Resumption of log file processing at the point where the last run left off
- No dependencies beyond the Python standard library
%package examples
Summary: Class library for writing Nagios (Icinga) plugins
Group: Documentation/Other
Requires: %{name} = %{version}
%description examples
nagiosplugin is a Python class library which helps writing Nagios (or
Icinga) compatible plugins in Python. It cares for much of the
boilerplate code and default logic commonly found in Nagios checks,
including:
- Nagios 3 Plugin API compliant parameters and output formatting
- Full Nagios range syntax support
- Automatic threshold checking
- Multiple independent measures
- Custom status line to communicate the main point quickly
- Long output and performance data
- Timeout handling
- Persistent "cookies" to retain state information between check runs
- Resumption of log file processing at the point where the last run left off
- No dependencies beyond the Python standard library
This package contains example scripts.
%if 0%{?python2_enable}
%package -n python%{python2_pkgversion}-nagiosplugin
Summary: Class library for writing Nagios (Icinga) plugins
Requires: %{name} = %{version}
%description -n python%{python2_pkgversion}-nagiosplugin
nagiosplugin is a Python class library which helps writing Nagios (or
Icinga) compatible plugins in Python. It cares for much of the
boilerplate code and default logic commonly found in Nagios checks,
including:
- Nagios 3 Plugin API compliant parameters and output formatting
- Full Nagios range syntax support
- Automatic threshold checking
- Multiple independent measures
- Custom status line to communicate the main point quickly
- Long output and performance data
- Timeout handling
- Persistent "cookies" to retain state information between check runs
- Resumption of log file processing at the point where the last run left off
- No dependencies beyond the Python standard library
%endif
%package -n python%{python3_pkgversion}-nagiosplugin
Summary: Class library for writing Nagios (Icinga) plugins
Requires: %{name} = %{version}
%description -n python%{python3_pkgversion}-nagiosplugin
nagiosplugin is a Python class library which helps writing Nagios (or
Icinga) compatible plugins in Python. It cares for much of the
boilerplate code and default logic commonly found in Nagios checks,
including:
- Nagios 3 Plugin API compliant parameters and output formatting
- Full Nagios range syntax support
- Automatic threshold checking
- Multiple independent measures
- Custom status line to communicate the main point quickly
- Long output and performance data
- Timeout handling
- Persistent "cookies" to retain state information between check runs
- Resumption of log file processing at the point where the last run left off
- No dependencies beyond the Python standard library
%if 0%{?python3_other_pkgversion}
%package -n python%{python3_other_pkgversion}-nagiosplugin
Summary: Class library for writing Nagios (Icinga) plugins
Requires: %{name} = %{version}
%description -n python%{python3_other_pkgversion}-nagiosplugin
nagiosplugin is a Python class library which helps writing Nagios (or
Icinga) compatible plugins in Python. It cares for much of the
boilerplate code and default logic commonly found in Nagios checks,
including:
- Nagios 3 Plugin API compliant parameters and output formatting
- Full Nagios range syntax support
- Automatic threshold checking
- Multiple independent measures
- Custom status line to communicate the main point quickly
- Long output and performance data
- Timeout handling
- Persistent "cookies" to retain state information between check runs
- Resumption of log file processing at the point where the last run left off
- No dependencies beyond the Python standard library
%endif
%prep
%setup -q -n nagiosplugin-%{version}
%install
%if 0%{?python2_enable}
rm -rf build
%{__python2} setup.py install --optimize=1 --root=%{buildroot}
%endif
rm -rf build
%{__python3} setup.py install --optimize=1 --root=%{buildroot}
%if 0%{?python3_other_pkgversion}
rm -rf build
%{__python3_other} setup.py install --optimize=1 --root=%{buildroot}
%endif
%__install -d -m 755 %{buildroot}%{_docdir}/%{name}/examples
%__cp -pr CONTRIBUTORS.txt HACKING.txt HISTORY.txt README.txt \
%{buildroot}%{_docdir}/%{name}
%__cp -pr nagiosplugin/examples/check_*.py \
%{buildroot}%{_docdir}/%{name}/examples
%__chmod -f a-x %{buildroot}%{_docdir}/%{name}/examples/*.py
%if 0%{?suse_version} >= 1110
%fdupes %{buildroot}
%endif
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%doc %{_docdir}/%{name}
%if 0%{?add_license}
%license LICENSE.txt
%endif
%exclude %{_docdir}/%{name}/examples
%files examples
%defattr(-,root,root)
%doc %{_docdir}/%{name}/examples
%if 0%{?python2_enable}
%files -n python%{python2_pkgversion}-nagiosplugin
%defattr(-,root,root)
%{python2_sitelib}/*
%exclude %{python2_sitelib}/nagiosplugin/examples
%endif
%files -n python%{python3_pkgversion}-nagiosplugin
%defattr(-,root,root)
%{python3_sitelib}/*
%exclude %{python3_sitelib}/nagiosplugin/examples
%if 0%{?python3_other_pkgversion}
%files -n python%{python3_other_pkgversion}-nagiosplugin
%defattr(-,root,root)
%{python3_other_sitelib}/*
%exclude %{python3_other_sitelib}/nagiosplugin/examples
%endif
%changelog