2 # Split examplest to separate module
4 %bcond_with doc # don't build doc
5 %bcond_without tests # do not perform "make test"
6 %bcond_without python2 # CPython 2.x module
7 %bcond_without python3 # CPython 3.x module
9 %define module nagiosplugin
10 Summary: Python class library which helps writing Nagios (or Icinga) compatible plugins easily in Python
11 Summary(pl.UTF-8): Biblioteka klas Pythona pomagająca łatwo pisać wtyczki dla Nagiosa (lub Icingi) w Pythonie
12 # Name must match the python module/package name (as in 'import' statement)
13 Name: python-%{module}
17 Group: Libraries/Python
19 # https://pypi.python.org/packages/source/n/nagiosplugin/nagiosplugin-1.2.2.tar.gz
20 Source0: https://pypi.python.org/packages/source/n/%{module}/%{module}-%{version}.tar.gz
21 # Source0-md5: c85e1641492d606d929b02aa262bf55d
23 BuildRequires: rpm-pythonprov
24 # remove BR: python-devel for 'noarch' packages.
25 # if py_postclean is used
26 BuildRequires: rpmbuild(macros) >= 1.219
27 # when using /usr/bin/env or other in-place substitutions
28 #BuildRequires: sed >= 4.0
29 # when python3 present
31 BuildRequires: python-devel
32 BuildRequires: python-setuptools
35 BuildRequires: python3-devel
36 BuildRequires: python3-modules
37 BuildRequires: python3-setuptools
39 # Below Rs only work for main package (python2)
40 #Requires: python-libs
41 Requires: python-modules
43 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
46 nagiosplugin is a Python class library which helps writing Nagios (or
47 Icinga) compatible plugins easily in Python. It cares for much of the
48 boilerplate code and default logic commonly found in Nagios checks
50 %description -l pl.UTF-8
51 nagiosplugin jest biblioteką klas Pythona pomagającą łatwo pisać
52 wtyczki dla Nagiosa (lub Icingi) w Pythonie. Dostarcza większość
53 typowego kodu i domyślna logikę zawartą w testach Nagiosa.
55 %package -n python3-%{module}
58 Group: Libraries/Python
59 Requires: python3-modules
61 %description -n python3-%{module}
62 nagiosplugin is a Python class library which helps writing Nagios (or
63 Icinga) compatible plugins easily in Python. It cares for much of the
64 boilerplate code and default logic commonly found in Nagios checks
66 %description -n python3-%{module} -l pl.UTF-8
67 nagiosplugin jest biblioteką klas Pythona pomagającą łatwo pisać
68 wtyczki dla Nagiosa (lub Icingi) w Pythonie. Dostarcza większość
69 typowego kodu i domyślna logikę zawartą w testach Nagiosa.
72 Summary: %{module} API documentation
73 Summary(pl.UTF-8): Dokumentacja API %{module}
77 API documentation for %{module}.
79 %description apidocs -l pl.UTF-8
80 Dokumentacja API %{module}.
83 %setup -q -n %{module}-%{version}
85 # fix #!%{_bindir}/env python -> #!%{_bindir}/python:
86 #%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py
88 # setup copy of source in py3 dir
95 %{__python} setup.py build --build-base build-2 %{?with_tests:test}
99 %{__python3} setup.py build --build-base build-3 %{?with_tests:test}
105 rm -rf _build/html/_sources
109 rm -rf $RPM_BUILD_ROOT
112 %{__python} setup.py \
113 build --build-base build-2 \
114 install --skip-build \
116 --root=$RPM_BUILD_ROOT
122 %{__python3} setup.py \
123 build --build-base build-3 \
124 install --skip-build \
126 --root=$RPM_BUILD_ROOT
130 # when files are installed in other way that standard 'setup.py
131 # they need to be (re-)compiled
132 ## change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
133 #%%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
134 #%%py_comp $RPM_BUILD_ROOT%{py_sitedir}
138 rm -rf $RPM_BUILD_ROOT
142 %defattr(644,root,root,755)
143 %doc HACKING.txt CONTRIBUTORS.txt HISTORY.txt README.txt
144 # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
145 %dir %{py_sitescriptdir}/%{module}
146 %{py_sitescriptdir}/%{module}/*.py[co]
147 %dir %{py_sitescriptdir}/%{module}/platform
148 %{py_sitescriptdir}/%{module}/platform/*.py[co]
149 %dir %{py_sitescriptdir}/%{module}/tests
150 %{py_sitescriptdir}/%{module}/tests/*.py[co]
151 %if "%{py_ver}" > "2.4"
152 %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
154 # %{_examplesdir}/%{name}-%{version}
158 %files -n python3-%{module}
159 %defattr(644,root,root,755)
160 %doc HACKING.txt CONTRIBUTORS.txt HISTORY.txt README.txt
161 %{py3_sitescriptdir}/%{module}
162 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
163 # %{_examplesdir}/python3-%{module}-%{version}
168 %defattr(644,root,root,755)
169 %doc docs/_build/html/*