]>
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 | |
0574dee1 | 6 | %bcond_with python3 # CPython 3.x module |
d11597d7 AM |
7 | |
8 | %define module maxminddb | |
9 | Summary: Python extension for reading the MaxMind DB format | |
10 | Name: python-%{module} | |
11 | Version: 1.1.1 | |
0574dee1 | 12 | Release: 16 |
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 | |
d11597d7 AM |
27 | BuildRequires: python3-modules |
28 | %endif | |
29 | Requires: python-ipaddr | |
30 | Requires: python-modules | |
31 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
32 | ||
33 | %description | |
34 | This is a Python module for reading MaxMind DB files. | |
35 | ||
36 | MaxMind DB is a binary file format that stores data indexed by IP | |
37 | address subnets (IPv4 or IPv6). | |
38 | ||
39 | %package -n python3-%{module} | |
40 | Summary: Python extension for reading the MaxMind DB format | |
41 | Group: Libraries/Python | |
42 | Requires: python3-modules | |
43 | ||
44 | %description -n python3-%{module} | |
45 | This is a Python module for reading MaxMind DB files. | |
46 | ||
47 | MaxMind DB is a binary file format that stores data indexed by IP | |
48 | address subnets (IPv4 or IPv6). | |
49 | ||
50 | %package apidocs | |
51 | Summary: %{module} API documentation | |
52 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
53 | Group: Documentation | |
ef558b1b | 54 | BuildArch: noarch |
d11597d7 AM |
55 | |
56 | %description apidocs | |
57 | API documentation for %{module}. | |
58 | ||
59 | %description apidocs -l pl.UTF-8 | |
60 | Dokumentacja API %{module}. | |
61 | ||
62 | %prep | |
63 | %setup -q -n %{module}-%{version} | |
64 | ||
65 | %build | |
66 | %if %{with python2} | |
67 | CC="%{__cc}" \ | |
68 | CFLAGS="%{rpmcppflags} %{rpmcflags}" \ | |
d23282ad | 69 | %py_build %{?with_tests:test} |
d11597d7 AM |
70 | %endif |
71 | ||
72 | %if %{with python3} | |
73 | CC="%{__cc}" \ | |
74 | CFLAGS="%{rpmcppflags} %{rpmcflags}" \ | |
d23282ad | 75 | %py3_build %{?with_tests:test} |
d11597d7 AM |
76 | %endif |
77 | ||
78 | %if %{with doc} | |
79 | cd docs | |
80 | %{__make} -j1 html | |
81 | rm -rf _build/html/_sources | |
82 | %endif | |
83 | ||
84 | %install | |
85 | rm -rf $RPM_BUILD_ROOT | |
86 | ||
87 | %if %{with python2} | |
d23282ad | 88 | %py_install |
d11597d7 AM |
89 | |
90 | %py_postclean | |
91 | %endif | |
92 | ||
93 | %if %{with python3} | |
d23282ad | 94 | %py3_install |
d11597d7 AM |
95 | %endif |
96 | ||
97 | %clean | |
98 | rm -rf $RPM_BUILD_ROOT | |
99 | ||
100 | %if %{with python2} | |
101 | %files | |
102 | %defattr(644,root,root,755) | |
103 | %doc HISTORY.rst README.rst | |
104 | %dir %{py_sitedir}/maxminddb | |
105 | %{py_sitedir}/maxminddb/*.py[co] | |
106 | %attr(755,root,root) %{py_sitedir}/maxminddb/*.so | |
107 | %if "%{py_ver}" > "2.4" | |
108 | %{py_sitedir}/%{module}-%{version}-py*.egg-info | |
109 | %endif | |
110 | %endif | |
111 | ||
112 | %if %{with python3} | |
113 | %files -n python3-%{module} | |
114 | %defattr(644,root,root,755) | |
115 | %doc HISTORY.rst README.rst | |
116 | %{py3_sitedir}/%{module} | |
117 | %{py3_sitedir}/%{module}-%{version}-py*.egg-info | |
118 | %endif | |
119 | ||
120 | %if %{with doc} | |
121 | %files apidocs | |
122 | %defattr(644,root,root,755) | |
123 | %doc docs/html/* | |
124 | %endif |