]>
Commit | Line | Data |
---|---|---|
d8dd0aa7 AM |
1 | # Conditional build: |
2 | %bcond_with doc # Sphinx documentation | |
3 | %bcond_with tests # unit tests | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | %define module bitstring | |
8 | %define egg_name bitstring | |
9 | %define pypi_name bitstring | |
10 | Summary: A Python module to help you manage your bits | |
11 | Name: python-%{pypi_name} | |
12 | Version: 3.1.5 | |
166a5ea9 | 13 | Release: 5 |
d8dd0aa7 AM |
14 | License: MIT |
15 | Group: Libraries/Python | |
16 | Source0: https://github.com/scott-griffiths/bitstring/archive/bitstring-%{version}.tar.gz | |
17 | # Source0-md5: ba96be1d2ae5ad35e4263c6a1c8bc310 | |
18 | URL: https://github.com/scott-griffiths/bitstring | |
19 | BuildRequires: rpm-pythonprov | |
20 | BuildRequires: rpmbuild(macros) >= 1.714 | |
21 | %if %{with python2} | |
22 | BuildRequires: python-modules | |
23 | BuildRequires: python-setuptools | |
24 | %endif | |
25 | %if %{with python3} | |
26 | BuildRequires: python3-modules | |
27 | BuildRequires: python3-setuptools | |
28 | %endif | |
29 | Requires: python-modules | |
30 | BuildArch: noarch | |
31 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
32 | ||
33 | %description | |
34 | bitstring is a pure Python module designed to help make the creation | |
35 | and analysis of binary data as simple and natural as possible. | |
36 | ||
37 | Bitstrings can be constructed from integers (big and little endian), | |
38 | hex, octal, binary, strings or files. They can be sliced, joined, | |
39 | reversed, inserted into, overwritten, etc. with simple functions or | |
40 | slice notation. They can also be read from, searched and replaced, and | |
41 | navigated in, similar to a file or stream. | |
42 | ||
43 | %package -n python3-%{pypi_name} | |
44 | Summary: A Python module to help you manage your bits | |
45 | Group: Libraries/Python | |
46 | Requires: python3-modules | |
47 | ||
48 | %description -n python3-%{pypi_name} | |
49 | bitstring is a pure Python module designed to help make the creation | |
50 | and analysis of binary data as simple and natural as possible. | |
51 | ||
52 | Bitstrings can be constructed from integers (big and little endian), | |
53 | hex, octal, binary, strings or files. They can be sliced, joined, | |
54 | reversed, inserted into, overwritten, etc. with simple functions or | |
55 | slice notation. They can also be read from, searched and replaced, and | |
56 | navigated in, similar to a file or stream. | |
57 | ||
58 | %package apidocs | |
59 | Summary: API documentation for Python %{module} module | |
60 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona %{module} | |
61 | Group: Documentation | |
62 | ||
63 | %description apidocs | |
64 | API documentation for Python %{module} module. | |
65 | ||
66 | %description apidocs -l pl.UTF-8 | |
67 | Dokumentacja API modułu Pythona %{module}. | |
68 | ||
69 | %prep | |
70 | %setup -q -n %{pypi_name}-%{pypi_name}-%{version} | |
71 | ||
72 | %build | |
73 | %if %{with python2} | |
74 | %py_build %{?with_tests:test} | |
75 | %endif | |
76 | ||
77 | %if %{with python3} | |
78 | %py3_build %{?with_tests:test} | |
79 | %endif | |
80 | ||
81 | %if %{with doc} | |
82 | cd doc | |
83 | %{__make} -j1 html | |
84 | rm -rf _build/html/_sources | |
85 | %endif | |
86 | ||
87 | %install | |
88 | rm -rf $RPM_BUILD_ROOT | |
89 | ||
90 | %if %{with python2} | |
91 | %py_install | |
92 | ||
93 | %py_ocomp $RPM_BUILD_ROOT%{py_sitedir} | |
94 | %py_comp $RPM_BUILD_ROOT%{py_sitedir} | |
95 | ||
96 | %py_postclean | |
97 | %endif | |
98 | ||
99 | %if %{with python3} | |
100 | %py3_install | |
101 | %endif | |
102 | ||
103 | %clean | |
104 | rm -rf $RPM_BUILD_ROOT | |
105 | ||
106 | %if %{with python2} | |
107 | %files | |
108 | %defattr(644,root,root,755) | |
109 | %doc README.rst | |
110 | %{py_sitescriptdir}/%{module}.py[co] | |
111 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
112 | %endif | |
113 | ||
114 | %if %{with python3} | |
115 | %files -n python3-%{pypi_name} | |
116 | %defattr(644,root,root,755) | |
117 | %doc README.rst | |
118 | %{py3_sitescriptdir}/%{module}.py | |
119 | %{py3_sitescriptdir}/__pycache__/%{module}.*.py[co] | |
120 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
121 | %endif | |
122 | ||
123 | %if %{with doc} | |
124 | %files apidocs | |
125 | %defattr(644,root,root,755) | |
126 | %doc docs/_build/html/* | |
127 | %endif |