]>
Commit | Line | Data |
---|---|---|
99aed9db JR |
1 | # |
2 | # Conditional build: | |
3 | %bcond_with integration # Integration tests work in mock but fail in Koji with PermissionError | |
401c9fd8 JB |
4 | %bcond_with tests # unit tests |
5 | %bcond_without python2 # CPython 2.x module | |
9006ed26 | 6 | %bcond_with python3 # CPython 3.x module (built from python3-zeroconf.spec) |
99aed9db | 7 | |
401c9fd8 | 8 | %define module zeroconf |
99aed9db | 9 | Summary: Pure Python Multicast DNS Service Discovery Library |
401c9fd8 JB |
10 | Summary(pl.UTF-8): Czysto pythonowa biblioteka Multicast DNS Service Discovery |
11 | Name: python-%{module} | |
12 | # keep 0.19.x here for python2 support | |
13 | Version: 0.19.1 | |
14 | Release: 1 | |
15 | License: LGPL v2 | |
99aed9db | 16 | Group: Libraries/Python |
401c9fd8 JB |
17 | #Source0Download: https://github.com/jstasiak/python-zeroconf/releases |
18 | Source0: https://github.com/jstasiak/python-zeroconf/archive/%{version}/%{module}-%{version}.tar.gz | |
19 | # Source0-md5: bda83913df1669610ba3c09f8133614e | |
20 | Patch0: %{name}-mock.patch | |
21 | URL: https://github.com/jstasiak/python-zeroconf | |
99aed9db | 22 | %if %{with python2} |
401c9fd8 JB |
23 | BuildRequires: python-devel >= 1:2.6 |
24 | BuildRequires: python-setuptools | |
25 | %if %{with tests} | |
99aed9db JR |
26 | BuildRequires: python-enum34 |
27 | BuildRequires: python-mock | |
401c9fd8 | 28 | BuildRequires: python-netifaces >= 0.10.6 |
99aed9db | 29 | BuildRequires: python-pytest |
99aed9db JR |
30 | BuildRequires: python-six |
31 | %endif | |
401c9fd8 | 32 | %endif |
99aed9db | 33 | %if %{with python3} |
401c9fd8 | 34 | BuildRequires: python3-devel >= 1:3.4 |
99aed9db | 35 | BuildRequires: python3-setuptools |
401c9fd8 JB |
36 | %if %{with tests} |
37 | BuildRequires: python3-netifaces >= 0.10.6 | |
38 | BuildRequires: python3-pytest | |
99aed9db JR |
39 | BuildRequires: python3-six |
40 | %endif | |
401c9fd8 JB |
41 | %endif |
42 | BuildRequires: rpm-pythonprov | |
43 | BuildRequires: rpmbuild(macros) >= 1.714 | |
9006ed26 | 44 | BuildRequires: sed >= 4.0 |
99aed9db JR |
45 | BuildArch: noarch |
46 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
47 | ||
48 | %description | |
49 | A pure Python implementation of multicast DNS service discovery | |
50 | supporting Bonjour/Avahi. | |
51 | ||
401c9fd8 JB |
52 | %description -l pl.UTF-8 |
53 | Czysto pythonowa implementacja wykrywania usług multicastowych DNS | |
54 | przy użyciu Bonjour/Avahi. | |
55 | ||
56 | %package -n python3-%{module} | |
57 | Summary: Pure Python Multicast DNS Service Discovery Library | |
58 | Summary(pl.UTF-8): Czysto pythonowa biblioteka Multicast DNS Service Discovery | |
99aed9db | 59 | Group: Libraries/Python |
99aed9db | 60 | |
401c9fd8 JB |
61 | %description -n python3-%{module} |
62 | A pure Python implementation of multicast DNS service discovery | |
99aed9db JR |
63 | supporting Bonjour/Avahi. |
64 | ||
401c9fd8 JB |
65 | %description -n python3-%{module} -l pl.UTF-8 |
66 | Czysto pythonowa implementacja wykrywania usług multicastowych DNS | |
67 | przy użyciu Bonjour/Avahi. | |
68 | ||
99aed9db JR |
69 | %prep |
70 | %setup -q | |
401c9fd8 | 71 | %patch0 -p1 |
99aed9db JR |
72 | |
73 | # Remove enum-compat from install_requires | |
74 | # See https://bugzilla.redhat.com/show_bug.cgi?id=1432165 | |
9006ed26 | 75 | %{__sed} -i '/enum-compat/d' setup.py |
99aed9db JR |
76 | |
77 | %build | |
78 | %if %{with python2} | |
79 | %py_build | |
401c9fd8 | 80 | |
99aed9db | 81 | %if %{with tests} |
401c9fd8 | 82 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
99aed9db | 83 | %{__python} -m pytest \ |
401c9fd8 | 84 | %{!?with_integration:-k "not integration"} |
99aed9db JR |
85 | %endif |
86 | %endif | |
87 | ||
88 | %if %{with python3} | |
401c9fd8 | 89 | %py3_build |
99aed9db JR |
90 | |
91 | %if %{with tests} | |
401c9fd8 | 92 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
99aed9db | 93 | %{__python3} -m pytest \ |
401c9fd8 | 94 | %{!?with_integration:-k "not integration"} |
99aed9db JR |
95 | %endif |
96 | %endif | |
97 | ||
98 | %install | |
99 | rm -rf $RPM_BUILD_ROOT | |
100 | ||
101 | %if %{with python2} | |
102 | %py_install | |
103 | ||
99aed9db JR |
104 | %py_postclean |
105 | %endif | |
106 | ||
107 | %if %{with python3} | |
108 | %py3_install | |
109 | %endif | |
110 | ||
111 | %clean | |
112 | rm -rf $RPM_BUILD_ROOT | |
113 | ||
114 | %if %{with python2} | |
115 | %files | |
116 | %defattr(644,root,root,755) | |
117 | %doc README.rst | |
401c9fd8 JB |
118 | %{py_sitescriptdir}/zeroconf.py[co] |
119 | %{py_sitescriptdir}/zeroconf-%{version}-py*.egg-info | |
99aed9db JR |
120 | %endif |
121 | ||
122 | %if %{with python3} | |
401c9fd8 | 123 | %files -n python3-%{module} |
99aed9db JR |
124 | %defattr(644,root,root,755) |
125 | %doc README.rst | |
401c9fd8 JB |
126 | %{py3_sitescriptdir}/__pycache__/zeroconf.cpython-*.py[co] |
127 | %{py3_sitescriptdir}/zeroconf.py | |
128 | %{py3_sitescriptdir}/zeroconf-%{version}-py*.egg-info | |
99aed9db | 129 | %endif |