]> git.pld-linux.org Git - projects/template-specs.git/blob - python3.spec
cb6dd2c3890c0f0280d095f44ab3fa876e62c728
[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 %endif
37 # replace with other requires if defined in setup.py
38 Requires:       python3-modules >= 1:3.2
39 BuildArch:      noarch
40 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42 %description
43
44 %description -l pl.UTF-8
45
46 %package apidocs
47 Summary:        API documentation for Python %{module} module
48 Summary(pl.UTF-8):      Dokumentacja API modułu Pythona %{module}
49 Group:          Documentation
50
51 %description apidocs
52 API documentation for Python %{module} module.
53
54 %description apidocs -l pl.UTF-8
55 Dokumentacja API modułu Pythona %{module}.
56
57 %prep
58 %setup -q -n %{module}-%{version}
59
60 # fix #!/usr/bin/env python -> #!/usr/bin/python:
61 #%{__sed} -i -e '1s,^#!.*python3,#!%{__python3},' %{name}.py
62
63 %build
64 %py3_build
65 # deprecated target, but sometimes still used: %{?with_tests:test}
66
67 %if %{with tests}
68 %{__python3} -m pytest ...
69 %endif
70
71 %if %{with doc}
72 %{__make} -C docs html \
73         SPHINXBUILD=sphinx-build-3
74 rm -rf docs/_build/html/_sources
75 %endif
76
77 %install
78 rm -rf $RPM_BUILD_ROOT
79
80 %py3_install
81
82 %if %{with enable_if_there_are_examples_provided_in_package}
83 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
84 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
85 find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
86         | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
87 %endif
88
89 %clean
90 rm -rf $RPM_BUILD_ROOT
91
92 %files
93 %defattr(644,root,root,755)
94 %doc AUTHORS CREDITS ChangeLog NEWS README THANKS TODO
95 %dir %{py3_sitescriptdir}/%{module}
96 %{py3_sitescriptdir}/%{module}/*.py
97 %{py3_sitescriptdir}/%{module}/__pycache__
98 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
99 %{_examplesdir}/%{name}-%{version}
100
101 %if %{with doc}
102 %files apidocs
103 %defattr(644,root,root,755)
104 %doc docs/_build/html/*
105 %endif
This page took 0.079947 seconds and 2 git commands to generate.