]> git.pld-linux.org Git - projects/template-specs.git/blame - python3.spec
- unified -devel description
[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
5d9fed48
AM
36# or
37BuildRequires: python3-tox
367df2cb
JB
38%endif
39# replace with other requires if defined in setup.py
b95097ca 40Requires: python3-modules >= 1:3.2
367df2cb
JB
41BuildArch: noarch
42BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
43
44%description
45
46%description -l pl.UTF-8
47
367df2cb 48%package apidocs
1a50796a
JB
49Summary: API documentation for Python %{module} module
50Summary(pl.UTF-8): Dokumentacja API modułu Pythona %{module}
367df2cb
JB
51Group: Documentation
52
53%description apidocs
1a50796a 54API documentation for Python %{module} module.
367df2cb
JB
55
56%description apidocs -l pl.UTF-8
1a50796a 57Dokumentacja API modułu Pythona %{module}.
367df2cb
JB
58
59%prep
60%setup -q -n %{module}-%{version}
61
62# fix #!/usr/bin/env python -> #!/usr/bin/python:
63#%{__sed} -i -e '1s,^#!.*python3,#!%{__python3},' %{name}.py
64
65%build
66%py3_build
67# deprecated target, but sometimes still used: %{?with_tests:test}
68
69%if %{with tests}
5d9fed48 70%{__python3} -m pytest tests
367df2cb
JB
71%endif
72
73%if %{with doc}
74%{__make} -C docs html \
75 SPHINXBUILD=sphinx-build-3
76rm -rf docs/_build/html/_sources
5d9fed48
AM
77
78# or
79
80%{_bindir}/tox -e docs
367df2cb
JB
81%endif
82
83%install
84rm -rf $RPM_BUILD_ROOT
85
86%py3_install
87
88%if %{with enable_if_there_are_examples_provided_in_package}
89install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
90cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
91find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
92 | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
93%endif
94
95%clean
96rm -rf $RPM_BUILD_ROOT
97
98%files
99%defattr(644,root,root,755)
100%doc AUTHORS CREDITS ChangeLog NEWS README THANKS TODO
101%dir %{py3_sitescriptdir}/%{module}
102%{py3_sitescriptdir}/%{module}/*.py
103%{py3_sitescriptdir}/%{module}/__pycache__
104%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
105%{_examplesdir}/%{name}-%{version}
106
107%if %{with doc}
108%files apidocs
109%defattr(644,root,root,755)
110%doc docs/_build/html/*
111%endif
This page took 0.413805 seconds and 4 git commands to generate.