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