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