3 %bcond_with integration # Integration tests work in mock but fail in Koji with PermissionError
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
8 %define pypi_name zeroconf
9 Summary: Pure Python Multicast DNS Service Discovery Library
10 Name: python-%{pypi_name}
14 Group: Libraries/Python
15 Source0: https://github.com/jstasiak/%{name}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
16 # Source0-md5: f40e133a2cec3087761e5230cdf8637c
17 URL: https://github.com/jstasiak/python-%{pypi_name}
19 BuildRequires: python-devel
20 BuildRequires: python-enum34
21 BuildRequires: python-mock
22 BuildRequires: python-netifaces
23 BuildRequires: python-pytest
24 BuildRequires: python-setuptools
25 BuildRequires: python-six
28 BuildRequires: python3-devel
29 BuildRequires: python3-mock
30 BuildRequires: python3-netifaces
31 BuildRequires: python3-pytest
32 BuildRequires: python3-setuptools
33 BuildRequires: python3-six
36 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
39 A pure Python implementation of multicast DNS service discovery
40 supporting Bonjour/Avahi.
42 %package -n python3-%{pypi_name}
43 Summary: Pure Python 3 Multicast DNS Service Discovery Library
44 Group: Libraries/Python
45 Requires: python3-netifaces
48 %description -n python3-%{pypi_name}
49 A pure Python 3 implementation of multicast DNS service discovery
50 supporting Bonjour/Avahi.
55 # Remove enum-compat from install_requires
56 # See https://bugzilla.redhat.com/show_bug.cgi?id=1432165
57 sed -i '/enum-compat/d' setup.py
63 %{__python} -m pytest \
64 %{!?with_integartion:-k "not integration"}
69 %py3_build %{?with_tests:test}
72 %{__python3} -m pytest \
73 %{!?with_integartion:-k "not integration"}
78 rm -rf $RPM_BUILD_ROOT
83 # when files are installed in other way that standard 'setup.py
84 # they need to be (re-)compiled
85 # change %{py_sitedir} to %{py_sitescriptdir} for 'noarch' packages!
86 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
87 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
97 rm -rf $RPM_BUILD_ROOT
101 %defattr(644,root,root,755)
103 %{py_sitescriptdir}/%{pypi_name}.py[co]
104 %{py_sitescriptdir}/%{pypi_name}-%{version}-py*.egg-info
108 %files -n python3-%{pypi_name}
109 %defattr(644,root,root,755)
111 %{py3_sitescriptdir}/__pycache__/*
112 %{py3_sitescriptdir}/%{pypi_name}.py
113 %{py3_sitescriptdir}/%{pypi_name}-%{version}-py*.egg-info