]> git.pld-linux.org Git - projects/template-specs.git/blob - python3.spec
dokuwiki-plugin.spec: Fix packaging languages with rpm 4.12
[projects/template-specs.git] / python3.spec
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
11 Summary:        -
12 Summary(pl.UTF-8):      -
13 # Name must match the python module/package name (as on pypi or in 'import' statement)
14 Name:           python3-%{module}
15 Version:        _
16 Release:        0.1
17 License:        - (enter GPL/GPL v2/GPL v3/LGPL/BSD/BSD-like/other license name here)
18 Group:          Libraries/Python
19 # if pypi:
20 #Source0Download: https://pypi.org/simple/MODULE/
21 Source0:        https://files.pythonhosted.org/packages/source/M/MODULE/%{module}-%{version}.tar.gz
22 # Source0-md5:  -
23 #URL:           https://pypi.org/project/MODULE/
24 URL:            -
25 BuildRequires:  python3-modules >= 1:3.2
26 #BuildRequires: python3-setuptools
27 %if %{with tests}
28 #BuildRequires: python3-
29 %endif
30 BuildRequires:  rpm-pythonprov
31 BuildRequires:  rpmbuild(macros) >= 1.714
32 # when using /usr/bin/env or other in-place substitutions
33 #BuildRequires:        sed >= 4.0
34 %if %{with doc}
35 BuildRequires:  sphinx-pdg-3
36 # or
37 BuildRequires:  python3-tox
38 %endif
39 # replace with other requires if defined in setup.py
40 Requires:       python3-modules >= 1:3.2
41 BuildArch:      noarch
42 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
43
44 %description
45
46 %description -l pl.UTF-8
47
48 %package apidocs
49 Summary:        API documentation for Python %{module} module
50 Summary(pl.UTF-8):      Dokumentacja API modułu Pythona %{module}
51 Group:          Documentation
52
53 %description apidocs
54 API documentation for Python %{module} module.
55
56 %description apidocs -l pl.UTF-8
57 Dokumentacja 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)
71 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
72 PYTEST_PLUGINS= \
73 %{__python3} -m pytest tests
74 %endif
75
76 %if %{with doc}
77 %{__make} -C docs html \
78         SPHINXBUILD=sphinx-build-3
79 rm -rf docs/_build/html/_sources
80
81 # or
82
83 %{_bindir}/tox -e docs
84 %endif
85
86 %install
87 rm -rf $RPM_BUILD_ROOT
88
89 %py3_install
90
91 %if %{with enable_if_there_are_examples_provided_in_package}
92 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
93 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
94 find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
95         | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
96 %endif
97
98 %clean
99 rm -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.041701 seconds and 3 git commands to generate.