]>
Commit | Line | Data |
---|---|---|
87566cae | 1 | # |
4ed00615 | 2 | # Conditional build: |
a173f249 JB |
3 | %bcond_without doc # Sphinx documentation |
4 | %bcond_without tests # unit tests | |
4ed00615 | 5 | %bcond_without python2 # CPython 2.x module |
72e4bc5c | 6 | %bcond_with python3 # CPython 3.x module (built from python3-lz4.spec) |
4ed00615 | 7 | |
87566cae | 8 | %define module lz4 |
4ed00615 | 9 | Summary: LZ4 bindings for Python |
a173f249 | 10 | Summary(pl.UTF-8): Wiązania LZ4 dla Pythona |
4ed00615 | 11 | Name: python-%{module} |
a173f249 | 12 | # keep 2.x here for python2 support |
87566cae | 13 | Version: 2.2.1 |
4a54862e | 14 | Release: 5 |
4ed00615 AM |
15 | License: BSD |
16 | Group: Libraries/Python | |
a173f249 JB |
17 | #Source0Download: https://pypi.org/simple/lz4/ |
18 | Source0: https://files.pythonhosted.org/packages/source/l/lz4/lz4-%{version}.tar.gz | |
87566cae | 19 | # Source0-md5: 778661bc5271b5befe11ee127c252a5d |
4ed00615 | 20 | URL: https://github.com/python-lz4/python-lz4 |
a173f249 JB |
21 | BuildRequires: lz4-devel >= 1:1.7.5 |
22 | BuildRequires: py3c >= 1.0 | |
4ed00615 | 23 | %if %{with python2} |
a173f249 | 24 | BuildRequires: python-devel >= 1:2.7 |
e0748709 | 25 | BuildRequires: python-pkgconfig |
a173f249 JB |
26 | BuildRequires: python-setuptools |
27 | BuildRequires: python-setuptools_scm | |
4ed00615 AM |
28 | %if %{with tests} |
29 | BuildRequires: python-future | |
e0748709 | 30 | BuildRequires: python-psutil |
a173f249 | 31 | BuildRequires: python-pytest >= 3.3.1 |
4ed00615 | 32 | BuildRequires: python-pytest-cov |
03c7a58b | 33 | BuildRequires: python-pytest-runner |
4ed00615 AM |
34 | %endif |
35 | %endif | |
36 | %if %{with python3} | |
a173f249 | 37 | BuildRequires: python3-devel >= 1:3.4 |
e0748709 | 38 | BuildRequires: python3-pkgconfig |
a173f249 JB |
39 | BuildRequires: python3-setuptools |
40 | BuildRequires: python3-setuptools_scm | |
4ed00615 | 41 | %if %{with tests} |
e0748709 | 42 | BuildRequires: python3-psutil |
a173f249 | 43 | BuildRequires: python3-pytest >= 3.3.1 |
4ed00615 | 44 | BuildRequires: python3-pytest-cov |
03c7a58b | 45 | BuildRequires: python3-pytest-runner |
4ed00615 AM |
46 | %endif |
47 | %endif | |
a173f249 JB |
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 | |
4ed00615 AM |
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 | |
a173f249 | 64 | Summary(pl.UTF-8): Wiązania LZ4 dla Pythona |
4ed00615 | 65 | Group: Libraries/Python |
a173f249 JB |
66 | Requires: lz4-libs >= 1:1.7.5 |
67 | Requires: python3-modules >= 1:3.4 | |
4ed00615 AM |
68 | |
69 | %description -n python3-%{module} | |
70 | This package provides python bindings for the LZ4 compression library. | |
71 | ||
72 | %package apidocs | |
a173f249 JB |
73 | Summary: API documentation for Python %{module} module |
74 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona %{module} | |
4ed00615 | 75 | Group: Documentation |
a173f249 | 76 | BuildArch: noarch |
4ed00615 AM |
77 | |
78 | %description apidocs | |
a173f249 | 79 | API documentation for Python %{module} module. |
4ed00615 AM |
80 | |
81 | %description apidocs -l pl.UTF-8 | |
a173f249 | 82 | Dokumentacja API modułu Pythona %{module}. |
4ed00615 AM |
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} | |
a173f249 JB |
97 | PYTHONPATH=$(pwd)/$(echo build-2/lib.*):$(pwd) \ |
98 | %{__make} -C docs html \ | |
99 | SPHINXBUILD=sphinx-build-2 | |
4ed00615 AM |
100 | %endif |
101 | ||
102 | %install | |
103 | rm -rf $RPM_BUILD_ROOT | |
a173f249 | 104 | |
4ed00615 AM |
105 | %if %{with python2} |
106 | %py_install | |
a173f249 | 107 | |
4ed00615 AM |
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) | |
a173f249 | 121 | %doc LICENSE README.rst |
4ed00615 AM |
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) | |
a173f249 | 137 | %doc LICENSE README.rst |
4ed00615 AM |
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) | |
a173f249 | 156 | %doc docs/_build/html/{_static,*.html,*.js} |
4ed00615 | 157 | %endif |