3 %bcond_without tests # do not perform "make test"
4 %bcond_without python3 # CPython 3.x module
6 %define module template
9 # Name must match the python module/package name (as in 'import' statement)
10 Name: python-%{module}
13 License: - (enter GPL/GPL v2/GPL v3/LGPL/BSD/BSD-like/other license name here)
14 Group: Libraries/Python
15 Source0: %{name}-%{version}.tar.gz
18 # remove BR: python-devel for 'noarch' packages.
19 BuildRequires: python-devel
20 BuildRequires: python-distribute
21 BuildRequires: rpm-pythonprov
22 # if py_postclean is used
23 BuildRequires: rpmbuild(macros) >= 1.219
24 # when python3 present
25 BuildRequires: sed >= 4.0
27 BuildRequires: python3-devel
28 BuildRequires: python3-distribute
29 BuildRequires: python3-modules
31 #Requires: python-libs
32 Requires: python-modules
34 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
38 %description -l pl.UTF-8
41 Summary: %{module} API documentation
42 Summary(pl.UTF-8): Dokumentacja API %{module}
46 API documentation for %{module}.
48 %description apidoc -l pl.UTF-8
49 Dokumentacja API %{module}.
52 %setup -q -n %{module}-%{version}
54 # fix #!/usr/bin/env python -> #!/usr/bin/python:
55 #%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py
62 find build-3 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
67 %{__python} setup.py build --build-base build-2
70 %{__python3} setup.py build --build-base build-3
73 # CC/CFLAGS is only for arch packages - remove on noarch packages
75 CFLAGS="%{rpmcflags}" \
76 %{__python} setup.py build
77 %{__python} setup.py \
80 %{?with_tests:%{__python} setup.py test}
83 %{__python3} setup.py \
87 %{__python3} setup.py test
94 rm -rf _build/html/_sources
98 rm -rf $RPM_BUILD_ROOT
99 %{__python} setup.py install \
102 --root=$RPM_BUILD_ROOT
104 %{__python} -- setup.py \
107 --root=$RPM_BUILD_ROOT \
111 %{__python} setup.py \
112 build --build-base build-2 \
114 --root=$RPM_BUILD_ROOT \
120 %{__python3} -- setup.py \
123 --root=$RPM_BUILD_ROOT \
127 %{__python3} setup.py \
128 build --build-base build-3 \
130 --root=$RPM_BUILD_ROOT \
134 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
135 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
137 # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
138 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
139 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
143 rm -rf $RPM_BUILD_ROOT
146 %defattr(644,root,root,755)
147 %doc AUTHORS CREDITS ChangeLog NEWS README THANKS TODO
148 # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
149 %{py_sitedir}/*.py[co]
150 %attr(755,root,root) %{py_sitedir}/*.so
151 %if "%{py_ver}" > "2.4"
152 %{py_sitedir}/TEMPLATE-*.egg-info
154 %{_examplesdir}/%{name}-%{version}
158 %defattr(644,root,root,755)
159 %doc AUTHORS CHANGES LICENSE
160 %{py_sitescriptdir}/%{module}
161 %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
165 %files -n python3-%{module}
166 %defattr(644,root,root,755)
167 %doc AUTHORS CHANGES LICENSE
168 %{py3_sitescriptdir}/%{module}
169 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
174 %defattr(644,root,root,755)
175 %doc docs/_build/html/*