]>
Commit | Line | Data |
---|---|---|
7b621577 MK |
1 | # TODO: |
2 | # Split examplest to separate module | |
63ec028d | 3 | # |
7b621577 MK |
4 | # Conditional build: |
5 | %bcond_with doc # don't build doc | |
6 | %bcond_without tests # do not perform "make test" | |
7 | %bcond_without python2 # CPython 2.x module | |
8 | %bcond_without python3 # CPython 3.x module | |
9 | ||
10 | %define module nagiosplugin | |
11 | Summary: Python class library which helps writing Nagios (or Icinga) compatible plugins easily in Python | |
12 | Summary(pl.UTF-8): Biblioteka klas Pythona pomagająca łatwo pisać wtyczki dla Nagiosa (lub Icingi) w Pythonie | |
7b621577 | 13 | Name: python-%{module} |
52380365 AM |
14 | Version: 1.3.3 |
15 | Release: 1 | |
7b621577 MK |
16 | License: ZPL 2.1 |
17 | Group: Libraries/Python | |
52380365 AM |
18 | Source0: https://pypi.debian.net/%{module}/%{module}-%{version}.tar.gz |
19 | # Source0-md5: 7539bf58002fb1285706d91e94dd4e26 | |
7b621577 MK |
20 | URL: nagiosplugin |
21 | BuildRequires: rpm-pythonprov | |
72ef76f7 | 22 | BuildRequires: rpmbuild(macros) >= 1.710 |
7b621577 MK |
23 | %if %{with python2} |
24 | BuildRequires: python-devel | |
25 | BuildRequires: python-setuptools | |
52380365 AM |
26 | %if %{with tests} |
27 | BuildRequires: python-pytest | |
28 | %endif | |
7b621577 MK |
29 | %endif |
30 | %if %{with python3} | |
31 | BuildRequires: python3-devel | |
32 | BuildRequires: python3-modules | |
33 | BuildRequires: python3-setuptools | |
52380365 AM |
34 | %if %{with tests} |
35 | BuildRequires: python3-pytest | |
36 | %endif | |
7b621577 | 37 | %endif |
7b621577 MK |
38 | Requires: python-modules |
39 | BuildArch: noarch | |
40 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
41 | ||
42 | %description | |
43 | nagiosplugin is a Python class library which helps writing Nagios (or | |
44 | Icinga) compatible plugins easily in Python. It cares for much of the | |
45 | boilerplate code and default logic commonly found in Nagios checks | |
46 | ||
47 | %description -l pl.UTF-8 | |
48 | nagiosplugin jest biblioteką klas Pythona pomagającą łatwo pisać | |
49 | wtyczki dla Nagiosa (lub Icingi) w Pythonie. Dostarcza większość | |
50 | typowego kodu i domyślna logikę zawartą w testach Nagiosa. | |
51 | ||
52 | %package -n python3-%{module} | |
63ec028d ER |
53 | Summary: Python class library which helps writing Nagios (or Icinga) compatible plugins easily in Python |
54 | Summary(pl.UTF-8): Biblioteka klas Pythona pomagająca łatwo pisać wtyczki dla Nagiosa (lub Icingi) w Pythonie | |
7b621577 MK |
55 | Group: Libraries/Python |
56 | Requires: python3-modules | |
57 | ||
58 | %description -n python3-%{module} | |
59 | nagiosplugin is a Python class library which helps writing Nagios (or | |
60 | Icinga) compatible plugins easily in Python. It cares for much of the | |
61 | boilerplate code and default logic commonly found in Nagios checks | |
62 | ||
63 | %description -n python3-%{module} -l pl.UTF-8 | |
64 | nagiosplugin jest biblioteką klas Pythona pomagającą łatwo pisać | |
65 | wtyczki dla Nagiosa (lub Icingi) w Pythonie. Dostarcza większość | |
66 | typowego kodu i domyślna logikę zawartą w testach Nagiosa. | |
67 | ||
68 | %package apidocs | |
69 | Summary: %{module} API documentation | |
70 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
71 | Group: Documentation | |
72 | ||
73 | %description apidocs | |
74 | API documentation for %{module}. | |
75 | ||
76 | %description apidocs -l pl.UTF-8 | |
77 | Dokumentacja API %{module}. | |
78 | ||
79 | %prep | |
80 | %setup -q -n %{module}-%{version} | |
81 | ||
1a00d221 | 82 | install -d examples |
52380365 | 83 | cp -p nagiosplugin/examples/check_*.py examples |
1a00d221 | 84 | |
7b621577 MK |
85 | %build |
86 | %if %{with python2} | |
52380365 AM |
87 | %py_build |
88 | ||
89 | %if %{with tests} | |
90 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
91 | %{__python} -m pytest tests | |
92 | %endif | |
7b621577 MK |
93 | %endif |
94 | ||
95 | %if %{with python3} | |
52380365 AM |
96 | %py3_build |
97 | ||
98 | %if %{with tests} | |
99 | %{__python3} -m pytest tests | |
100 | %endif | |
7b621577 MK |
101 | %endif |
102 | ||
103 | %if %{with doc} | |
104 | cd docs | |
105 | %{__make} -j1 html | |
106 | rm -rf _build/html/_sources | |
107 | %endif | |
108 | ||
109 | %install | |
110 | rm -rf $RPM_BUILD_ROOT | |
111 | ||
112 | %if %{with python2} | |
5a273683 | 113 | %py_install |
7b621577 | 114 | |
63ec028d | 115 | %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/%{module}/examples |
7b621577 | 116 | %py_postclean |
1a00d221 ER |
117 | |
118 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} | |
119 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} | |
7b621577 MK |
120 | %endif |
121 | ||
122 | %if %{with python3} | |
5a273683 | 123 | %py3_install |
7b621577 | 124 | |
63ec028d | 125 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/%{module}/examples |
1a00d221 ER |
126 | |
127 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
128 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
63ec028d | 129 | %endif |
7b621577 MK |
130 | |
131 | %clean | |
132 | rm -rf $RPM_BUILD_ROOT | |
133 | ||
134 | %if %{with python2} | |
135 | %files | |
136 | %defattr(644,root,root,755) | |
137 | %doc HACKING.txt CONTRIBUTORS.txt HISTORY.txt README.txt | |
63ec028d | 138 | %{py_sitescriptdir}/%{module} |
7b621577 | 139 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info |
1a00d221 | 140 | %{_examplesdir}/python-%{module}-%{version} |
7b621577 | 141 | %endif |
7b621577 MK |
142 | |
143 | %if %{with python3} | |
144 | %files -n python3-%{module} | |
145 | %defattr(644,root,root,755) | |
146 | %doc HACKING.txt CONTRIBUTORS.txt HISTORY.txt README.txt | |
147 | %{py3_sitescriptdir}/%{module} | |
148 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
1a00d221 | 149 | %{_examplesdir}/python3-%{module}-%{version} |
7b621577 MK |
150 | %endif |
151 | ||
152 | %if %{with doc} | |
153 | %files apidocs | |
154 | %defattr(644,root,root,755) | |
155 | %doc docs/_build/html/* | |
156 | %endif |