2 # This is template for pure python 3 modules
3 # use template-specs/python.spec for pure python2/python3 packages
4 # use template-specs/python3-ext.spec for binary python3 packages
7 %bcond_without doc # API documentation
8 %bcond_without tests # unit tests
10 %define module template
13 # Name must match the python module/package name (as on pypi or in 'import' statement)
14 Name: python3-%{module}
17 License: - (enter GPL/GPL v2/GPL v3/LGPL/BSD/BSD-like/other license name here)
18 Group: Libraries/Python
20 #Source0Download: https://pypi.org/simple/MODULE/
21 Source0: https://files.pythonhosted.org/packages/source/M/MODULE/%{module}-%{version}.tar.gz
23 #URL: https://pypi.org/project/MODULE/
25 BuildRequires: python3-modules >= 1:3.2
26 #BuildRequires: python3-setuptools
28 #BuildRequires: python3-
30 BuildRequires: rpm-pythonprov
31 BuildRequires: rpmbuild(macros) >= 1.714
32 # when using /usr/bin/env or other in-place substitutions
33 #BuildRequires: sed >= 4.0
35 BuildRequires: sphinx-pdg-3
37 # replace with other requires if defined in setup.py
38 Requires: python3-modules >= 1:3.2
40 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
44 %description -l pl.UTF-8
47 Summary: API documentation for Python %{module} module
48 Summary(pl.UTF-8): Dokumentacja API modułu Pythona %{module}
52 API documentation for Python %{module} module.
54 %description apidocs -l pl.UTF-8
55 Dokumentacja API modułu Pythona %{module}.
58 %setup -q -n %{module}-%{version}
60 # fix #!/usr/bin/env python -> #!/usr/bin/python:
61 #%{__sed} -i -e '1s,^#!.*python3,#!%{__python3},' %{name}.py
65 # deprecated target, but sometimes still used: %{?with_tests:test}
68 %{__python3} -m pytest ...
72 %{__make} -C docs html \
73 SPHINXBUILD=sphinx-build-3
74 rm -rf docs/_build/html/_sources
78 rm -rf $RPM_BUILD_ROOT
82 %if %{with enable_if_there_are_examples_provided_in_package}
83 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
84 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
85 find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
86 | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
90 rm -rf $RPM_BUILD_ROOT
93 %defattr(644,root,root,755)
94 %doc AUTHORS CREDITS ChangeLog NEWS README THANKS TODO
95 %dir %{py3_sitescriptdir}/%{module}
96 %{py3_sitescriptdir}/%{module}/*.py
97 %{py3_sitescriptdir}/%{module}/__pycache__
98 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
99 %{_examplesdir}/%{name}-%{version}
103 %defattr(644,root,root,755)
104 %doc docs/_build/html/*