]>
Commit | Line | Data |
---|---|---|
3476df9a JR |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
446688ef | 4 | %bcond_without python2 # Python 3.x module |
3476df9a JR |
5 | %bcond_without python3 # Python 3.x module |
6 | ||
7 | %define module bitarray | |
8 | Summary: Efficient arrays of booleans -- C extension | |
9 | Name: python-%{module} | |
ee6a3db6 | 10 | Version: 1.0.1 |
fdc46207 | 11 | Release: 7 |
3476df9a JR |
12 | License: PSF |
13 | Group: Libraries/Python | |
ee6a3db6 | 14 | # Source0: https://pypi.python.org/packages/source/b/bitarray/%{module}-%{version}.tar.gz |
729a915f JR |
15 | Source0: https://github.com/ilanschnell/bitarray/archive/%{version}/%{module}-%{version}.tar.gz |
16 | # Source0-md5: 046fce932e24c8ce717500b129750f9c | |
3476df9a JR |
17 | URL: https://pypi.python.org/pypi/bitarray/ |
18 | BuildRequires: python-devel | |
19 | BuildRequires: python-distribute | |
20 | BuildRequires: rpm-pythonprov | |
21 | # if py_postclean is used | |
49eda72a | 22 | BuildRequires: rpmbuild(macros) >= 1.710 |
3476df9a JR |
23 | # when python3 present |
24 | BuildRequires: sed >= 4.0 | |
25 | %if %{with python3} | |
26 | BuildRequires: python3-devel | |
3476df9a JR |
27 | BuildRequires: python3-modules |
28 | %endif | |
29 | Requires: python-libs | |
30 | Requires: python-modules | |
31 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
32 | ||
33 | %description | |
446688ef JK |
34 | This module provides an object type which efficiently represents an |
35 | array of booleans. Bitarrays are sequence types and behave very much | |
36 | like usual lists. Eight bits are represented by one byte in a | |
37 | contiguous block of memory. The user can select between two | |
38 | representations; little-endian and big-endian. All of the | |
39 | functionality is implemented in C. Methods for accessing the machine | |
40 | representation are provided. This can be useful when bit level access | |
41 | to binary files is required, such as portable bitmap image files | |
42 | (.pbm). Also, when dealing with compressed data which uses variable | |
43 | bit length encoding, you may find this module useful. | |
3476df9a JR |
44 | |
45 | %package apidoc | |
46 | Summary: %{module} API documentation | |
47 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
48 | Group: Documentation | |
49 | ||
50 | %description apidoc | |
51 | API documentation for %{module}. | |
52 | ||
53 | %description apidoc -l pl.UTF-8 | |
54 | Dokumentacja API %{module}. | |
55 | ||
56 | %package -n python3-%{module} | |
57 | Summary: Efficient arrays of booleans -- C extension | |
58 | Group: Libraries/Python | |
59 | Requires: python3-libs | |
60 | Requires: python3-modules | |
61 | ||
62 | %description -n python3-%{module} | |
446688ef JK |
63 | This module provides an object type which efficiently represents an |
64 | array of booleans. Bitarrays are sequence types and behave very much | |
65 | like usual lists. Eight bits are represented by one byte in a | |
66 | contiguous block of memory. The user can select between two | |
67 | representations; little-endian and big-endian. All of the | |
68 | functionality is implemented in C. Methods for accessing the machine | |
69 | representation are provided. This can be useful when bit level access | |
70 | to binary files is required, such as portable bitmap image files | |
71 | (.pbm). Also, when dealing with compressed data which uses variable | |
72 | bit length encoding, you may find this module useful. | |
3476df9a JR |
73 | |
74 | %prep | |
75 | %setup -q -n %{module}-%{version} | |
76 | ||
3476df9a JR |
77 | %build |
78 | %if %{with python2} | |
ee6a3db6 AM |
79 | %py_build |
80 | %if %{with tests} | |
81 | cd build-2 | |
82 | PYTHONPATH=$(pwd)/$(echo lib.linux-*) \ | |
83 | %{__python} -c 'import bitarray; bitarray.test()' | |
84 | cd .. | |
85 | %endif | |
3476df9a JR |
86 | %endif |
87 | %if %{with python3} | |
ee6a3db6 AM |
88 | %py3_build |
89 | %if %{with tests} | |
90 | cd build-3 | |
91 | PYTHONPATH=$(pwd)/$(echo lib.linux-*) \ | |
92 | %{__python3} -c 'import bitarray; bitarray.test()' | |
93 | cd .. | |
94 | %endif | |
3476df9a JR |
95 | %endif |
96 | ||
97 | %if %{with doc} | |
98 | cd docs | |
99 | %{__make} -j1 html | |
100 | rm -rf _build/html/_sources | |
101 | %endif | |
102 | ||
103 | %install | |
104 | rm -rf $RPM_BUILD_ROOT | |
446688ef | 105 | %py_install |
3476df9a JR |
106 | |
107 | %if %{with python3} | |
446688ef | 108 | %py3_install |
3476df9a JR |
109 | %endif |
110 | ||
111 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
112 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
113 | ||
3476df9a JR |
114 | %py_ocomp $RPM_BUILD_ROOT%{py_sitedir} |
115 | %py_comp $RPM_BUILD_ROOT%{py_sitedir} | |
116 | ||
117 | %clean | |
118 | rm -rf $RPM_BUILD_ROOT | |
119 | ||
120 | %files | |
121 | %defattr(644,root,root,755) | |
122 | %doc AUTHORS CHANGE_LOG README.rst TODO | |
3476df9a JR |
123 | %dir %{py_sitedir}/%{module} |
124 | %{py_sitedir}/%{module}/*.py[co] | |
125 | %attr(755,root,root) %{py_sitedir}/%{module}/*.so | |
126 | %{py_sitedir}/bitarray-*.egg-info | |
127 | %{_examplesdir}/%{name}-%{version} | |
128 | ||
129 | %if %{with python3} | |
130 | %files -n python3-%{module} | |
3476df9a | 131 | %defattr(644,root,root,755) |
446688ef | 132 | %doc AUTHORS CHANGE_LOG README.rst TODO |
3476df9a JR |
133 | %dir %{py3_sitedir}/%{module} |
134 | %{py3_sitedir}/%{module}/*.py* | |
135 | %{py3_sitedir}/%{module}/__pycache__ | |
136 | %attr(755,root,root) %{py3_sitedir}/%{module}/*.so | |
137 | %{py3_sitedir}/%{module}-%{version}-py*.egg-info | |
138 | %endif | |
139 | ||
140 | %if %{with doc} | |
141 | %files apidoc | |
142 | %defattr(644,root,root,755) | |
143 | %doc docs/_build/html/* | |
144 | %endif |