]>
Commit | Line | Data |
---|---|---|
2942bcd1 AM |
1 | # |
2 | # Conditional build: | |
3 | %bcond_with tests # do not perform "make test" | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | %define module bitmath | |
8 | Summary: Module for representing file sizes with different prefix notations | |
9 | Name: python-%{module} | |
34d7d096 | 10 | Version: 1.0.6 |
06d84368 | 11 | Release: 10 |
2942bcd1 AM |
12 | License: BSD |
13 | Group: Libraries/Python | |
14 | Source0: https://github.com/tbielawa/bitmath/archive/%{version}-1.tar.gz | |
34d7d096 | 15 | # Source0-md5: b589c9ceb7f518da043e089d519e8579 |
2942bcd1 AM |
16 | URL: https://github.com/tbielawa/bitmath |
17 | BuildRequires: rpm-pythonprov | |
ebb9d032 | 18 | BuildRequires: rpmbuild(macros) >= 1.710 |
2942bcd1 AM |
19 | %if %{with python2} |
20 | BuildRequires: python-distribute | |
21 | %endif | |
22 | %if %{with python3} | |
23 | BuildRequires: python3-distribute | |
24 | BuildRequires: python3-modules | |
25 | %endif | |
26 | Requires: python-modules | |
27 | BuildArch: noarch | |
28 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
29 | ||
30 | %description | |
31 | bitmath simplifies many facets of interacting with file sizes in | |
32 | various units. Examples include: converting between SI and NIST prefix | |
33 | units (GiB to kB), converting between units of the same type (SI to | |
34 | SI, or NIST to NIST), basic arithmetic operations (subtracting 42KiB | |
35 | from 50GiB), rich comparison operations (1024 Bytes == 1KiB), bitwise | |
36 | operations (<<, >>, &, |, ^), and sorting. | |
37 | ||
38 | In addition to the conversion and math operations, bitmath provides | |
39 | human readable representations of values which are suitable for use in | |
40 | interactive shells as well as larger scripts and applications. | |
41 | ||
42 | %package -n python3-%{module} | |
43 | Summary: Module for representing file sizes with different prefix notations | |
44 | Group: Libraries/Python | |
45 | ||
46 | %description -n python3-%{module} | |
47 | bitmath simplifies many facets of interacting with file sizes in | |
48 | various units. Examples include: converting between SI and NIST prefix | |
49 | units (GiB to kB), converting between units of the same type (SI to | |
50 | SI, or NIST to NIST), basic arithmetic operations (subtracting 42KiB | |
51 | from 50GiB), rich comparison operations (1024 Bytes == 1KiB), bitwise | |
52 | operations (<<, >>, &, |, ^), and sorting. | |
53 | ||
54 | In addition to the conversion and math operations, bitmath provides | |
55 | human readable representations of values which are suitable for use in | |
56 | interactive shells as well as larger scripts and applications. | |
57 | ||
58 | %package apidocs | |
59 | Summary: %{module} API documentation | |
60 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
61 | Group: Documentation | |
62 | ||
63 | %description apidocs | |
64 | API documentation for %{module}. | |
65 | ||
66 | %description apidocs -l pl.UTF-8 | |
67 | Dokumentacja API %{module}. | |
68 | ||
69 | %prep | |
70 | %setup -q -n %{module}-%{version}-1 | |
71 | ||
72 | %build | |
73 | %if %{with python2} | |
b0821b19 | 74 | %py_build %{?with_tests:test} |
2942bcd1 AM |
75 | %endif |
76 | ||
77 | %if %{with python3} | |
b0821b19 | 78 | %py3_build %{?with_tests:test} |
2942bcd1 AM |
79 | %endif |
80 | ||
81 | %if %{with doc} | |
82 | cd docs | |
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} | |
b0821b19 | 91 | %py_install |
2942bcd1 AM |
92 | |
93 | %py_postclean | |
94 | %endif | |
95 | ||
96 | %if %{with python3} | |
b0821b19 | 97 | %py3_install |
2942bcd1 AM |
98 | %endif |
99 | ||
100 | %clean | |
101 | rm -rf $RPM_BUILD_ROOT | |
102 | ||
103 | %if %{with python2} | |
104 | %files | |
105 | %defattr(644,root,root,755) | |
106 | %doc README.md | |
107 | %dir %{py_sitescriptdir}/%{module} | |
108 | %{py_sitescriptdir}/%{module}/*.py[co] | |
109 | %if "%{py_ver}" > "2.4" | |
110 | %{py_sitescriptdir}/%{module}-%{version}*.egg-info | |
111 | %endif | |
112 | %endif | |
113 | ||
114 | %if %{with python3} | |
115 | %files -n python3-%{module} | |
116 | %defattr(644,root,root,755) | |
117 | %doc README.md | |
118 | %{py3_sitescriptdir}/%{module} | |
119 | %{py3_sitescriptdir}/%{module}-%{version}*-py*.egg-info | |
120 | %endif | |
121 | ||
122 | %if %{with doc} | |
123 | %files apidocs | |
124 | %defattr(644,root,root,755) | |
125 | %doc docs/_build/html/* | |
126 | %endif |