]> git.pld-linux.org Git - projects/template-specs.git/blame - python3.spec
- spaces to tabs
[projects/template-specs.git] / python3.spec
CommitLineData
367df2cb
JB
1#
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
5#
6# Conditional build:
1a50796a
JB
7%bcond_without doc # API documentation
8%bcond_without tests # unit tests
367df2cb 9
688a1eb4 10%define module template
367df2cb
JB
11Summary: -
12Summary(pl.UTF-8): -
13# Name must match the python module/package name (as on pypi or in 'import' statement)
14Name: python3-%{module}
15Version: _
16Release: 0.1
17License: - (enter GPL/GPL v2/GPL v3/LGPL/BSD/BSD-like/other license name here)
18Group: Libraries/Python
19# if pypi:
20#Source0Download: https://pypi.org/simple/MODULE/
21Source0: https://files.pythonhosted.org/packages/source/M/MODULE/%{module}-%{version}.tar.gz
22# Source0-md5: -
23#URL: https://pypi.org/project/MODULE/
24URL: -
1a50796a 25BuildRequires: python3-modules >= 1:3.2
367df2cb
JB
26#BuildRequires: python3-setuptools
27%if %{with tests}
28#BuildRequires: python3-
29%endif
30BuildRequires: rpm-pythonprov
31BuildRequires: rpmbuild(macros) >= 1.714
367df2cb
JB
32# when using /usr/bin/env or other in-place substitutions
33#BuildRequires: sed >= 4.0
34%if %{with doc}
35BuildRequires: sphinx-pdg-3
36%endif
37# replace with other requires if defined in setup.py
b95097ca 38Requires: python3-modules >= 1:3.2
367df2cb
JB
39BuildArch: noarch
40BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42%description
43
44%description -l pl.UTF-8
45
367df2cb 46%package apidocs
1a50796a
JB
47Summary: API documentation for Python %{module} module
48Summary(pl.UTF-8): Dokumentacja API modułu Pythona %{module}
367df2cb
JB
49Group: Documentation
50
51%description apidocs
1a50796a 52API documentation for Python %{module} module.
367df2cb
JB
53
54%description apidocs -l pl.UTF-8
1a50796a 55Dokumentacja API modułu Pythona %{module}.
367df2cb
JB
56
57%prep
58%setup -q -n %{module}-%{version}
59
60# fix #!/usr/bin/env python -> #!/usr/bin/python:
61#%{__sed} -i -e '1s,^#!.*python3,#!%{__python3},' %{name}.py
62
63%build
64%py3_build
65# deprecated target, but sometimes still used: %{?with_tests:test}
66
67%if %{with tests}
68%{__python3} -m pytest ...
69%endif
70
71%if %{with doc}
72%{__make} -C docs html \
73 SPHINXBUILD=sphinx-build-3
74rm -rf docs/_build/html/_sources
75%endif
76
77%install
78rm -rf $RPM_BUILD_ROOT
79
80%py3_install
81
82%if %{with enable_if_there_are_examples_provided_in_package}
83install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
84cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
85find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
86 | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
87%endif
88
89%clean
90rm -rf $RPM_BUILD_ROOT
91
92%files
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}
100
101%if %{with doc}
102%files apidocs
103%defattr(644,root,root,755)
104%doc docs/_build/html/*
105%endif
This page took 0.089901 seconds and 4 git commands to generate.