]>
Commit | Line | Data |
---|---|---|
d11597d7 AM |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without doc # don't build doc | |
4 | %bcond_with tests # do not perform "make test" | |
5 | %bcond_without python2 # CPython 2.x module | |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
8 | %define module maxminddb | |
9 | Summary: Python extension for reading the MaxMind DB format | |
10 | Name: python-%{module} | |
11 | Version: 1.1.1 | |
9f910188 | 12 | Release: 9 |
d11597d7 AM |
13 | License: APL |
14 | Group: Libraries/Python | |
15 | Source0: https://pypi.python.org/packages/source/m/maxminddb/maxminddb-%{version}.tar.gz | |
16 | # Source0-md5: 70a6d2a4b70f08e5b509fbb83f239795 | |
17 | URL: https://pypi.python.org/pypi/maxminddb | |
cc558049 | 18 | BuildRequires: libmaxminddb-devel |
d11597d7 | 19 | BuildRequires: rpm-pythonprov |
5d71afa8 | 20 | BuildRequires: rpmbuild(macros) >= 1.710 |
d11597d7 AM |
21 | %if %{with python2} |
22 | BuildRequires: python-devel | |
23 | BuildRequires: python-distribute | |
24 | %endif | |
25 | %if %{with python3} | |
26 | BuildRequires: python3-devel | |
27 | BuildRequires: python3-distribute | |
28 | BuildRequires: python3-modules | |
29 | %endif | |
30 | Requires: python-ipaddr | |
31 | Requires: python-modules | |
32 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
33 | ||
34 | %description | |
35 | This is a Python module for reading MaxMind DB files. | |
36 | ||
37 | MaxMind DB is a binary file format that stores data indexed by IP | |
38 | address subnets (IPv4 or IPv6). | |
39 | ||
40 | %package -n python3-%{module} | |
41 | Summary: Python extension for reading the MaxMind DB format | |
42 | Group: Libraries/Python | |
43 | Requires: python3-modules | |
44 | ||
45 | %description -n python3-%{module} | |
46 | This is a Python module for reading MaxMind DB files. | |
47 | ||
48 | MaxMind DB is a binary file format that stores data indexed by IP | |
49 | address subnets (IPv4 or IPv6). | |
50 | ||
51 | %package apidocs | |
52 | Summary: %{module} API documentation | |
53 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
54 | Group: Documentation | |
ef558b1b | 55 | BuildArch: noarch |
d11597d7 AM |
56 | |
57 | %description apidocs | |
58 | API documentation for %{module}. | |
59 | ||
60 | %description apidocs -l pl.UTF-8 | |
61 | Dokumentacja API %{module}. | |
62 | ||
63 | %prep | |
64 | %setup -q -n %{module}-%{version} | |
65 | ||
66 | %build | |
67 | %if %{with python2} | |
68 | CC="%{__cc}" \ | |
69 | CFLAGS="%{rpmcppflags} %{rpmcflags}" \ | |
d23282ad | 70 | %py_build %{?with_tests:test} |
d11597d7 AM |
71 | %endif |
72 | ||
73 | %if %{with python3} | |
74 | CC="%{__cc}" \ | |
75 | CFLAGS="%{rpmcppflags} %{rpmcflags}" \ | |
d23282ad | 76 | %py3_build %{?with_tests:test} |
d11597d7 AM |
77 | %endif |
78 | ||
79 | %if %{with doc} | |
80 | cd docs | |
81 | %{__make} -j1 html | |
82 | rm -rf _build/html/_sources | |
83 | %endif | |
84 | ||
85 | %install | |
86 | rm -rf $RPM_BUILD_ROOT | |
87 | ||
88 | %if %{with python2} | |
d23282ad | 89 | %py_install |
d11597d7 AM |
90 | |
91 | %py_postclean | |
92 | %endif | |
93 | ||
94 | %if %{with python3} | |
d23282ad | 95 | %py3_install |
d11597d7 AM |
96 | %endif |
97 | ||
98 | %clean | |
99 | rm -rf $RPM_BUILD_ROOT | |
100 | ||
101 | %if %{with python2} | |
102 | %files | |
103 | %defattr(644,root,root,755) | |
104 | %doc HISTORY.rst README.rst | |
105 | %dir %{py_sitedir}/maxminddb | |
106 | %{py_sitedir}/maxminddb/*.py[co] | |
107 | %attr(755,root,root) %{py_sitedir}/maxminddb/*.so | |
108 | %if "%{py_ver}" > "2.4" | |
109 | %{py_sitedir}/%{module}-%{version}-py*.egg-info | |
110 | %endif | |
111 | %endif | |
112 | ||
113 | %if %{with python3} | |
114 | %files -n python3-%{module} | |
115 | %defattr(644,root,root,755) | |
116 | %doc HISTORY.rst README.rst | |
117 | %{py3_sitedir}/%{module} | |
118 | %{py3_sitedir}/%{module}-%{version}-py*.egg-info | |
119 | %endif | |
120 | ||
121 | %if %{with doc} | |
122 | %files apidocs | |
123 | %defattr(644,root,root,755) | |
124 | %doc docs/html/* | |
125 | %endif |