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