]> git.pld-linux.org Git - projects/template-specs.git/blame - python3.spec
- updated python2/3 templates, added python3-only variants
[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:
7%bcond_without doc # don't build doc
8%bcond_without tests # do not perform "make test"
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: -
25#BuildRequires: python3-setuptools
26%if %{with tests}
27#BuildRequires: python3-
28%endif
29BuildRequires: rpm-pythonprov
30BuildRequires: rpmbuild(macros) >= 1.714
31BuildRequires: python3-modules >= 1:3.2
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
38Requires: python-modules >= 1:2.5
39BuildArch: noarch
40BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42%description
43
44%description -l pl.UTF-8
45
46%package -n python3-%{module}
47Summary: -
48Summary(pl.UTF-8): -
49Group: Libraries/Python
50Requires: python3-modules >= 1:3.2
51
52%description -n python3-%{module}
53
54%description -n python3-%{module} -l pl.UTF-8
55
56%package apidocs
57Summary: %{module} API documentation
58Summary(pl.UTF-8): Dokumentacja API %{module}
59Group: Documentation
60
61%description apidocs
62API documentation for %{module}.
63
64%description apidocs -l pl.UTF-8
65Dokumentacja API %{module}.
66
67%prep
68%setup -q -n %{module}-%{version}
69
70# fix #!/usr/bin/env python -> #!/usr/bin/python:
71#%{__sed} -i -e '1s,^#!.*python3,#!%{__python3},' %{name}.py
72
73%build
74%py3_build
75# deprecated target, but sometimes still used: %{?with_tests:test}
76
77%if %{with tests}
78%{__python3} -m pytest ...
79%endif
80
81%if %{with doc}
82%{__make} -C docs html \
83 SPHINXBUILD=sphinx-build-3
84rm -rf docs/_build/html/_sources
85%endif
86
87%install
88rm -rf $RPM_BUILD_ROOT
89
90%py3_install
91
92%if %{with enable_if_there_are_examples_provided_in_package}
93install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
94cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
95find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
96 | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
97%endif
98
99%clean
100rm -rf $RPM_BUILD_ROOT
101
102%files
103%defattr(644,root,root,755)
104%doc AUTHORS CREDITS ChangeLog NEWS README THANKS TODO
105%dir %{py3_sitescriptdir}/%{module}
106%{py3_sitescriptdir}/%{module}/*.py
107%{py3_sitescriptdir}/%{module}/__pycache__
108%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
109%{_examplesdir}/%{name}-%{version}
110
111%if %{with doc}
112%files apidocs
113%defattr(644,root,root,755)
114%doc docs/_build/html/*
115%endif
This page took 0.052513 seconds and 4 git commands to generate.