]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Conditional build: | |
3 | %bcond_without doc # Sphinx documentation | |
4 | %bcond_without tests # unit tests | |
5 | %bcond_without python2 # CPython 2.x module | |
6 | %bcond_with python3 # CPython 3.x module (built from python3-lz4.spec) | |
7 | ||
8 | %define module lz4 | |
9 | Summary: LZ4 bindings for Python | |
10 | Summary(pl.UTF-8): Wiązania LZ4 dla Pythona | |
11 | Name: python-%{module} | |
12 | # keep 2.x here for python2 support | |
13 | Version: 2.2.1 | |
14 | Release: 2 | |
15 | License: BSD | |
16 | Group: Libraries/Python | |
17 | #Source0Download: https://pypi.org/simple/lz4/ | |
18 | Source0: https://files.pythonhosted.org/packages/source/l/lz4/lz4-%{version}.tar.gz | |
19 | # Source0-md5: 778661bc5271b5befe11ee127c252a5d | |
20 | URL: https://github.com/python-lz4/python-lz4 | |
21 | BuildRequires: lz4-devel >= 1:1.7.5 | |
22 | BuildRequires: py3c >= 1.0 | |
23 | %if %{with python2} | |
24 | BuildRequires: python-devel >= 1:2.7 | |
25 | BuildRequires: python-pkgconfig | |
26 | BuildRequires: python-setuptools | |
27 | BuildRequires: python-setuptools_scm | |
28 | %if %{with tests} | |
29 | BuildRequires: python-future | |
30 | BuildRequires: python-psutil | |
31 | BuildRequires: python-pytest >= 3.3.1 | |
32 | BuildRequires: python-pytest-cov | |
33 | BuildRequires: python-pytest-runner | |
34 | %endif | |
35 | %endif | |
36 | %if %{with python3} | |
37 | BuildRequires: python3-devel >= 1:3.4 | |
38 | BuildRequires: python3-pkgconfig | |
39 | BuildRequires: python3-setuptools | |
40 | BuildRequires: python3-setuptools_scm | |
41 | %if %{with tests} | |
42 | BuildRequires: python3-psutil | |
43 | BuildRequires: python3-pytest >= 3.3.1 | |
44 | BuildRequires: python3-pytest-cov | |
45 | BuildRequires: python3-pytest-runner | |
46 | %endif | |
47 | %endif | |
48 | BuildRequires: rpm-build >= 4.6 | |
49 | BuildRequires: rpm-pythonprov | |
50 | BuildRequires: rpmbuild(macros) >= 1.714 | |
51 | %if %{with doc} | |
52 | BuildRequires: python-sphinx_bootstrap_theme | |
53 | BuildRequires: sphinx-pdg-2 >= 1.6.0 | |
54 | %endif | |
55 | Requires: lz4-libs >= 1:1.7.5 | |
56 | Requires: python-modules >= 1:2.7 | |
57 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
58 | ||
59 | %description | |
60 | This package provides python bindings for the LZ4 compression library. | |
61 | ||
62 | %package -n python3-%{module} | |
63 | Summary: LZ4 bindings for Python | |
64 | Summary(pl.UTF-8): Wiązania LZ4 dla Pythona | |
65 | Group: Libraries/Python | |
66 | Requires: lz4-libs >= 1:1.7.5 | |
67 | Requires: python3-modules >= 1:3.4 | |
68 | ||
69 | %description -n python3-%{module} | |
70 | This package provides python bindings for the LZ4 compression library. | |
71 | ||
72 | %package apidocs | |
73 | Summary: API documentation for Python %{module} module | |
74 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona %{module} | |
75 | Group: Documentation | |
76 | BuildArch: noarch | |
77 | ||
78 | %description apidocs | |
79 | API documentation for Python %{module} module. | |
80 | ||
81 | %description apidocs -l pl.UTF-8 | |
82 | Dokumentacja API modułu Pythona %{module}. | |
83 | ||
84 | %prep | |
85 | %setup -q -n %{module}-%{version} | |
86 | ||
87 | %build | |
88 | %if %{with python2} | |
89 | %py_build %{?with_tests:test} | |
90 | %endif | |
91 | ||
92 | %if %{with python3} | |
93 | %py3_build %{?with_tests:test} | |
94 | %endif | |
95 | ||
96 | %if %{with doc} | |
97 | PYTHONPATH=$(pwd)/$(echo build-2/lib.*):$(pwd) \ | |
98 | %{__make} -C docs html \ | |
99 | SPHINXBUILD=sphinx-build-2 | |
100 | %endif | |
101 | ||
102 | %install | |
103 | rm -rf $RPM_BUILD_ROOT | |
104 | ||
105 | %if %{with python2} | |
106 | %py_install | |
107 | ||
108 | %py_postclean | |
109 | %endif | |
110 | ||
111 | %if %{with python3} | |
112 | %py3_install | |
113 | %endif | |
114 | ||
115 | %clean | |
116 | rm -rf $RPM_BUILD_ROOT | |
117 | ||
118 | %if %{with python2} | |
119 | %files | |
120 | %defattr(644,root,root,755) | |
121 | %doc LICENSE README.rst | |
122 | %dir %{py_sitedir}/%{module} | |
123 | %{py_sitedir}/%{module}/*.py[co] | |
124 | %dir %{py_sitedir}/%{module}/block | |
125 | %{py_sitedir}/%{module}/block/*.py[co] | |
126 | %dir %{py_sitedir}/%{module}/frame | |
127 | %{py_sitedir}/%{module}/frame/*.py[co] | |
128 | %attr(755,root,root) %{py_sitedir}/%{module}/*.so | |
129 | %attr(755,root,root) %{py_sitedir}/%{module}/block/*.so | |
130 | %attr(755,root,root) %{py_sitedir}/%{module}/frame/*.so | |
131 | %{py_sitedir}/%{module}-%{version}-py*.egg-info | |
132 | %endif | |
133 | ||
134 | %if %{with python3} | |
135 | %files -n python3-%{module} | |
136 | %defattr(644,root,root,755) | |
137 | %doc LICENSE README.rst | |
138 | %dir %{py3_sitedir}/%{module} | |
139 | %{py3_sitedir}/%{module}/*.py | |
140 | %dir %{py3_sitedir}/%{module}/block | |
141 | %{py3_sitedir}/%{module}/block/*.py | |
142 | %dir %{py3_sitedir}/%{module}/frame | |
143 | %{py3_sitedir}/%{module}/frame/*.py | |
144 | %attr(755,root,root) %{py3_sitedir}/%{module}/*.so | |
145 | %attr(755,root,root) %{py3_sitedir}/%{module}/block/*.so | |
146 | %attr(755,root,root) %{py3_sitedir}/%{module}/frame/*.so | |
147 | %{py3_sitedir}/%{module}/__pycache__ | |
148 | %{py3_sitedir}/%{module}/block/__pycache__ | |
149 | %{py3_sitedir}/%{module}/frame/__pycache__ | |
150 | %{py3_sitedir}/%{module}-%{version}-py*.egg-info | |
151 | %endif | |
152 | ||
153 | %if %{with doc} | |
154 | %files apidocs | |
155 | %defattr(644,root,root,755) | |
156 | %doc docs/_build/html/{_static,*.html,*.js} | |
157 | %endif |