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