]> git.pld-linux.org Git - packages/python-nagiosplugin.git/blob - python-nagiosplugin.spec
Initial version 1.2.2-1.
[packages/python-nagiosplugin.git] / python-nagiosplugin.spec
1 # TODO:
2 # Split examplest to separate module
3 # Conditional build:
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
8
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}
14 Version:        1.2.2
15 Release:        1
16 License:        ZPL 2.1
17 Group:          Libraries/Python
18
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
22 URL:            nagiosplugin
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
30 %if %{with python2}
31 BuildRequires:  python-devel
32 BuildRequires:  python-setuptools
33 %endif
34 %if %{with python3}
35 BuildRequires:  python3-devel
36 BuildRequires:  python3-modules
37 BuildRequires:  python3-setuptools
38 %endif
39 # Below Rs only work for main package (python2)
40 #Requires:              python-libs
41 Requires:       python-modules
42 BuildArch:      noarch
43 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
44
45 %description
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
49
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.
54
55 %package -n python3-%{module}
56 Summary:        -
57 Summary(pl.UTF-8):      -
58 Group:          Libraries/Python
59 Requires:       python3-modules
60
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
65
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.
70
71 %package apidocs
72 Summary:        %{module} API documentation
73 Summary(pl.UTF-8):      Dokumentacja API %{module}
74 Group:          Documentation
75
76 %description apidocs
77 API documentation for %{module}.
78
79 %description apidocs -l pl.UTF-8
80 Dokumentacja API %{module}.
81
82 %prep
83 %setup -q -n %{module}-%{version}
84
85 # fix #!%{_bindir}/env python -> #!%{_bindir}/python:
86 #%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py
87
88 # setup copy of source in py3 dir
89 set -- *
90 install -d py3
91 cp -a "$@" py3
92
93 %build
94 %if %{with python2}
95 %{__python} setup.py build --build-base build-2 %{?with_tests:test}
96 %endif
97
98 %if %{with python3}
99 %{__python3} setup.py build --build-base build-3 %{?with_tests:test}
100 %endif
101
102 %if %{with doc}
103 cd docs
104 %{__make} -j1 html
105 rm -rf _build/html/_sources
106 %endif
107
108 %install
109 rm -rf $RPM_BUILD_ROOT
110
111 %if %{with python2}
112 %{__python} setup.py \
113         build --build-base build-2 \
114         install --skip-build \
115         --optimize=2 \
116         --root=$RPM_BUILD_ROOT
117
118 %py_postclean
119 %endif
120
121 %if %{with python3}
122 %{__python3} setup.py \
123         build --build-base build-3 \
124         install --skip-build \
125         --optimize=2 \
126         --root=$RPM_BUILD_ROOT
127 %endif
128
129
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}
135 #%%py_postclean
136
137 %clean
138 rm -rf $RPM_BUILD_ROOT
139
140 %if %{with python2}
141 %files
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
153 %endif
154 # %{_examplesdir}/%{name}-%{version}
155 %endif
156
157 %if %{with python3}
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}
164 %endif
165
166 %if %{with doc}
167 %files apidocs
168 %defattr(644,root,root,755)
169 %doc docs/_build/html/*
170 %endif
This page took 0.06374 seconds and 4 git commands to generate.