2 # This is template for python 3 extension modules (including compiled C code)
3 # use template-specs/python3.spec for pure python packages
6 %bcond_without doc # don't build doc
7 %bcond_without tests # do not perform "make test"
9 %define module template
12 # Name must match the python module/package name (as on pypi or in 'import' statement)
13 Name: python3-%{module}
16 License: - (enter GPL/GPL v2/GPL v3/LGPL/BSD/BSD-like/other license name here)
17 Group: Libraries/Python
19 #Source0Download: https://pypi.org/simple/MODULE/
20 Source0: https://files.pythonhosted.org/packages/source/M/MODULE/%{module}-%{version}.tar.gz
22 #URL: https://pypi.org/project/MODULE/
24 #BuildRequires: python3-setuptools
26 #BuildRequires: python3-
28 BuildRequires: rpm-pythonprov
29 BuildRequires: rpmbuild(macros) >= 1.714
30 BuildRequires: python3-devel >= 1:3.2
31 # when using /usr/bin/env or other in-place substitutions
32 #BuildRequires: sed >= 4.0
34 BuildRequires: sphinx-pdg-3
36 # replace with other requires if defined in setup.py
37 Requires: python-modules >= 1:2.5
38 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
42 %description -l pl.UTF-8
44 %package -n python3-%{module}
47 Group: Libraries/Python
48 Requires: python3-modules >= 1:3.2
50 %description -n python3-%{module}
52 %description -n python3-%{module} -l pl.UTF-8
55 Summary: %{module} API documentation
56 Summary(pl.UTF-8): Dokumentacja API %{module}
58 %if "%{_rpmversion}" >= "4.6"
63 API documentation for %{module}.
65 %description apidocs -l pl.UTF-8
66 Dokumentacja API %{module}.
69 %setup -q -n %{module}-%{version}
71 # fix #!/usr/bin/env python -> #!/usr/bin/python:
72 #%{__sed} -i -e '1s,^#!.*python3,#!%{__python3},' %{name}.py
76 # deprecated target, but sometimes still used: %{?with_tests:test}
79 %{__python3} -m pytest ...
83 %{__make} -C docs html \
84 SPHINXBUILD=sphinx-build-3
85 rm -rf docs/_build/html/_sources
89 rm -rf $RPM_BUILD_ROOT
93 %if %{with enable_if_there_are_examples_provided_in_package}
94 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
95 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
96 find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
97 | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
101 rm -rf $RPM_BUILD_ROOT
104 %defattr(644,root,root,755)
105 %doc AUTHORS CREDITS ChangeLog NEWS README THANKS TODO
106 %dir %{py3_sitedir}/%{module}
107 %{py3_sitedir}/%{module}/*.py
108 %attr(755,root,root) %{py3_sitedir}/%{module}/*.so
109 %{py3_sitedir}/%{module}/__pycache__
110 %{py3_sitedir}/%{module}-%{version}-py*.egg-info
111 %{_examplesdir}/%{name}-%{version}
115 %defattr(644,root,root,755)
116 %doc docs/_build/html/*