]>
Commit | Line | Data |
---|---|---|
2249595d JK |
1 | # |
2 | # Conditional build: | |
0b29eab9 | 3 | %bcond_without apidocs # sphinx based documentation |
2249595d JK |
4 | %bcond_without python3 # do not build python3 modules |
5 | ||
feabb8f2 AM |
6 | %define module netaddr |
7 | Summary: A pure Python network address representation and manipulation library | |
8 | Name: python-netaddr | |
ca4d4c7e | 9 | Version: 0.7.19 |
5d2e9eff | 10 | Release: 5 |
feabb8f2 AM |
11 | License: BSD |
12 | Group: Development/Languages/Python | |
0b29eab9 | 13 | Source0: https://pypi.python.org/packages/source/n/netaddr/%{module}-%{version}.tar.gz |
ca4d4c7e | 14 | # Source0-md5: 51019ef59c93f3979bcb37d3b8527e07 |
390271c0 | 15 | Patch0: script-shebang.patch |
2249595d | 16 | URL: https://github.com/drkjam/netaddr/ |
7400cab7 | 17 | BuildRequires: rpmbuild(macros) >= 1.710 |
f90abd59 | 18 | BuildRequires: python-modules |
2249595d | 19 | %{?with_python3:BuildRequires: python3-modules} |
f90abd59 | 20 | BuildRequires: rpm-pythonprov |
0b29eab9 | 21 | %{?with_apidocs:BuildRequires: sphinx-pdg} |
feabb8f2 AM |
22 | BuildArch: noarch |
23 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
24 | ||
25 | %description | |
26 | A pure Python network address representation and manipulation library. | |
27 | ||
28 | netaddr provides a Pythonic way to work with: | |
29 | - IPv4 and IPv6 addresses and subnets (including CIDR notation) | |
30 | - MAC (Media Access Control) addresses in multiple presentation | |
31 | formats | |
32 | - IEEE EUI-64, OUI and IAB identifiers | |
33 | - nmap-style IP address ranges | |
34 | - a user friendly IP glob-style format | |
35 | ||
36 | Included are routines for: | |
37 | - generating, sorting and summarizing IP addresses | |
38 | - converting IP addresses and ranges between various different formats | |
39 | - performing set based operations on groups of IP addresses and | |
40 | subnets | |
41 | - arbitrary IP address range calculations and conversions | |
42 | - querying IEEE OUI and IAB organisational information | |
43 | - querying of IP standards related data from key IANA data sources | |
44 | ||
2249595d JK |
45 | %package -n python3-netaddr |
46 | Summary: A pure Python network address representation and manipulation library | |
47 | Group: Development/Languages/Python | |
48 | ||
49 | %description -n python3-netaddr | |
50 | A pure Python network address representation and manipulation library. | |
51 | ||
52 | netaddr provides a Pythonic way to work with: | |
53 | - IPv4 and IPv6 addresses and subnets (including CIDR notation) | |
54 | - MAC (Media Access Control) addresses in multiple presentation | |
55 | formats | |
56 | - IEEE EUI-64, OUI and IAB identifiers | |
57 | - nmap-style IP address ranges | |
58 | - a user friendly IP glob-style format | |
59 | ||
60 | Included are routines for: | |
61 | - generating, sorting and summarizing IP addresses | |
62 | - converting IP addresses and ranges between various different formats | |
63 | - performing set based operations on groups of IP addresses and | |
64 | subnets | |
65 | - arbitrary IP address range calculations and conversions | |
66 | - querying IEEE OUI and IAB organisational information | |
67 | - querying of IP standards related data from key IANA data sources | |
68 | ||
69 | %package -n netaddr | |
70 | Summary: An interactive shell for the Python netaddr library | |
71 | Group: Development/Languages/Python | |
390271c0 JP |
72 | %if %{with python3} |
73 | Requires: python3-netaddr = %{version}-%{release} | |
74 | %else | |
2249595d | 75 | Requires: %{name} = %{version}-%{release} |
390271c0 | 76 | %endif |
2249595d JK |
77 | |
78 | %description -n netaddr | |
79 | Interactive shell for the python-netaddr library. | |
80 | ||
feabb8f2 AM |
81 | %prep |
82 | %setup -q -n %{module}-%{version} | |
390271c0 JP |
83 | %patch0 -p1 |
84 | ||
85 | %{__sed} -i -e '1s,/usr/bin/env python,%{?with_python3:%{__python3}}%{!?with_python3:%{__python}},' \ | |
86 | netaddr/tools/netaddr | |
feabb8f2 AM |
87 | |
88 | %build | |
7b967b95 | 89 | %py_build |
feabb8f2 | 90 | |
2249595d | 91 | %if %{with python3} |
7b967b95 | 92 | %py3_build |
2249595d JK |
93 | %endif |
94 | ||
feabb8f2 AM |
95 | %install |
96 | rm -rf $RPM_BUILD_ROOT | |
7b967b95 | 97 | %py_install \ |
feabb8f2 AM |
98 | --optimize 2 \ |
99 | --root=$RPM_BUILD_ROOT | |
100 | ||
101 | %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
102 | %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
103 | %py_postclean | |
104 | ||
0b29eab9 JK |
105 | %if %{with apidocs} |
106 | sphinx-build -b html -d build/doctrees -D latex_paper_size=a4 docs/source build/html | |
107 | %endif | |
108 | ||
2249595d | 109 | %if %{with python3} |
7b967b95 | 110 | %py3_install \ |
2249595d JK |
111 | --optimize 2 \ |
112 | --root=$RPM_BUILD_ROOT | |
113 | %py3_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
114 | %py3_comp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
2249595d JK |
115 | %endif |
116 | ||
feabb8f2 AM |
117 | %clean |
118 | rm -rf $RPM_BUILD_ROOT | |
119 | ||
120 | %files | |
121 | %defattr(644,root,root,755) | |
ca4d4c7e | 122 | %doc AUTHORS CHANGELOG README.md |
0b29eab9 JK |
123 | %if %{with apidocs} |
124 | %doc build/html | |
125 | %endif | |
feabb8f2 AM |
126 | %{py_sitescriptdir}/*.egg-info |
127 | %dir %{py_sitescriptdir}/%{module} | |
128 | %{py_sitescriptdir}/%{module}/*.py[co] | |
ca4d4c7e AM |
129 | %dir %{py_sitescriptdir}/%{module}/contrib |
130 | %{py_sitescriptdir}/%{module}/contrib/*.py[co] | |
feabb8f2 AM |
131 | %dir %{py_sitescriptdir}/%{module}/eui |
132 | %{py_sitescriptdir}/%{module}/eui/*.py[co] | |
133 | %{py_sitescriptdir}/%{module}/eui/*.idx | |
134 | %{py_sitescriptdir}/%{module}/eui/*.txt | |
135 | %dir %{py_sitescriptdir}/%{module}/ip | |
136 | %{py_sitescriptdir}/%{module}/ip/*.py[co] | |
0b29eab9 | 137 | %{py_sitescriptdir}/%{module}/ip/*.xml |
feabb8f2 AM |
138 | %dir %{py_sitescriptdir}/%{module}/strategy |
139 | %{py_sitescriptdir}/%{module}/strategy/*.py[co] | |
ca4d4c7e AM |
140 | #%dir %{py_sitescriptdir}/%{module}/tests |
141 | #%{py_sitescriptdir}/%{module}/tests/*.py[co] | |
2249595d JK |
142 | #%{py_sitescriptdir}/%{module}/tests/2.x/core |
143 | #%{py_sitescriptdir}/%{module}/tests/2.x/eui | |
144 | #%{py_sitescriptdir}/%{module}/tests/2.x/ip | |
145 | #%{py_sitescriptdir}/%{module}/tests/2.x/strategy | |
146 | ||
147 | %if %{with python3} | |
148 | %files -n python3-netaddr | |
149 | %defattr(644,root,root,755) | |
ca4d4c7e | 150 | %doc AUTHORS CHANGELOG README.md |
0b29eab9 JK |
151 | %if %{with apidocs} |
152 | %doc build/html | |
153 | %endif | |
2249595d JK |
154 | %{py3_sitescriptdir}/*.egg-info |
155 | %dir %{py3_sitescriptdir}/%{module} | |
df012ee4 JK |
156 | %{py3_sitescriptdir}/%{module}/*.py |
157 | %{py3_sitescriptdir}/%{module}/__pycache__ | |
ca4d4c7e AM |
158 | %dir %{py3_sitescriptdir}/%{module}/contrib |
159 | %{py3_sitescriptdir}/%{module}/contrib/*.py | |
160 | %{py3_sitescriptdir}/%{module}/contrib/__pycache__ | |
2249595d | 161 | %dir %{py3_sitescriptdir}/%{module}/eui |
df012ee4 JK |
162 | %{py3_sitescriptdir}/%{module}/eui/*.py |
163 | %{py3_sitescriptdir}/%{module}/eui/__pycache__ | |
2249595d JK |
164 | %{py3_sitescriptdir}/%{module}/eui/*.idx |
165 | %{py3_sitescriptdir}/%{module}/eui/*.txt | |
166 | %dir %{py3_sitescriptdir}/%{module}/ip | |
df012ee4 JK |
167 | %{py3_sitescriptdir}/%{module}/ip/*.py |
168 | %{py3_sitescriptdir}/%{module}/ip/__pycache__ | |
0b29eab9 | 169 | %{py3_sitescriptdir}/%{module}/ip/*.xml |
2249595d | 170 | %dir %{py3_sitescriptdir}/%{module}/strategy |
df012ee4 JK |
171 | %{py3_sitescriptdir}/%{module}/strategy/*.py |
172 | %{py3_sitescriptdir}/%{module}/strategy/__pycache__ | |
ca4d4c7e AM |
173 | #%dir %{py3_sitescriptdir}/%{module}/tests |
174 | #%{py3_sitescriptdir}/%{module}/tests/*.py | |
175 | #%{py3_sitescriptdir}/%{module}/tests/__pycache__ | |
2249595d JK |
176 | #%{py3_sitescriptdir}/%{module}/tests/3.x/core |
177 | #%{py3_sitescriptdir}/%{module}/tests/3.x/eui | |
178 | #%{py3_sitescriptdir}/%{module}/tests/3.x/ip | |
179 | #%{py3_sitescriptdir}/%{module}/tests/3.x/strategy | |
180 | %endif | |
181 | ||
182 | %files -n netaddr | |
183 | %defattr(644,root,root,755) | |
184 | %attr(755,root,root) %{_bindir}/netaddr |