]> git.pld-linux.org Git - projects/template-specs.git/blame_incremental - python3.spec
dokuwiki-plugin.spec: Fix packaging languages with rpm 4.12
[projects/template-specs.git] / python3.spec
... / ...
CommitLineData
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:
7%bcond_without doc # API documentation
8%bcond_without tests # unit tests
9
10%define module template
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: -
25BuildRequires: python3-modules >= 1:3.2
26#BuildRequires: python3-setuptools
27%if %{with tests}
28#BuildRequires: python3-
29%endif
30BuildRequires: rpm-pythonprov
31BuildRequires: rpmbuild(macros) >= 1.714
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# or
37BuildRequires: python3-tox
38%endif
39# replace with other requires if defined in setup.py
40Requires: python3-modules >= 1:3.2
41BuildArch: noarch
42BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
43
44%description
45
46%description -l pl.UTF-8
47
48%package apidocs
49Summary: API documentation for Python %{module} module
50Summary(pl.UTF-8): Dokumentacja API modułu Pythona %{module}
51Group: Documentation
52
53%description apidocs
54API documentation for Python %{module} module.
55
56%description apidocs -l pl.UTF-8
57Dokumentacja API modułu Pythona %{module}.
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}
70# use explicit plugins list for reliable builds (delete PYTEST_PLUGINS if empty)
71PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
72PYTEST_PLUGINS= \
73%{__python3} -m pytest tests
74%endif
75
76%if %{with doc}
77%{__make} -C docs html \
78 SPHINXBUILD=sphinx-build-3
79rm -rf docs/_build/html/_sources
80
81# or
82
83%{_bindir}/tox -e docs
84%endif
85
86%install
87rm -rf $RPM_BUILD_ROOT
88
89%py3_install
90
91%if %{with enable_if_there_are_examples_provided_in_package}
92install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
93cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
94find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
95 | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
96%endif
97
98%clean
99rm -rf $RPM_BUILD_ROOT
100
101%files
102%defattr(644,root,root,755)
103%doc AUTHORS CREDITS ChangeLog NEWS README THANKS TODO
104%dir %{py3_sitescriptdir}/%{module}
105%{py3_sitescriptdir}/%{module}/*.py
106%{py3_sitescriptdir}/%{module}/__pycache__
107%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
108%{_examplesdir}/%{name}-%{version}
109
110%if %{with doc}
111%files apidocs
112%defattr(644,root,root,755)
113%doc docs/_build/html/*
114%endif
This page took 0.036105 seconds and 4 git commands to generate.