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