Blob Blame History Raw
# set upstream name variable
%global srcname aiodns


%if 0%{?fedora}
%bcond_without python3
%else
%bcond_with python3
%endif

Name:           python-aiodns
Version:        1.1.1
Release:        1%{?dist}
Summary:        Simple DNS resolver for asyncio

License:        MIT
URL:            https://github.com/saghul/aiodns
Source0:        https://github.com/saghul/%{srcname}/archive/%{srcname}-%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  python2-devel
BuildRequires:  python2-pycares
%if %{with python3}
BuildRequires:  python3-devel
BuildRequires:  python3-pycares
%endif # with python3
Requires:       python2-pycares
Requires:       python-trollius

%description
aiodns provides a simple way for doing asynchronous DNS resolutions
with a synchronous looking interface by using pycares.


%package      -n python2-%{srcname}
Summary:        Simple DNS resolver for asyncio
BuildArch:      noarch
Requires:       python2-pycares
Requires:       python-trollius
%{?python_provide:%python_provide python2-%{srcname}}

%description -n python2-%{srcname}
aiodns provides a simple way for doing asynchronous DNS resolutions
with a synchronous looking interface by using pycares.


%if %{with python3}
%package     -n python3-%{srcname}
Summary:        Simple DNS resolver for asyncio
BuildArch:      noarch
Requires:       python3-pycares
%{?python_provide:%python_provide python3-%{srcname}}

%description -n python3-%{srcname}
aiodns provides a simple way for doing asynchronous DNS resolutions
with a synchronous looking interface by using pycares.
%endif # with python3



%prep
%autosetup -n %{srcname}-%{srcname}-%{version}


%build
%py2_build

%if %{with python3}
%py3_build
%endif # with python3


%install
# Must do the python3 install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
%if %{with python3}
%py3_install
%endif # with python3

%py2_install


%check
# Unit tests perform DNS resolution and requires active Internet
# connection: disabling
##%{__python2} setup.py test

%if %{with python3}
##%{__python3} setup.py test
%endif



%files -n python2-%{srcname}
%license LICENSE
%doc README.rst ChangeLog
# For noarch packages: sitelib
%{python2_sitelib}/%{srcname}-%{version}-*.egg-info/
%{python2_sitelib}/%{srcname}/


%if %{with python3}
%files -n python3-%{srcname}
%license LICENSE
%doc README.rst ChangeLog
# For noarch packages: sitelib
%{python3_sitelib}/%{srcname}-%{version}-*.egg-info/
%{python3_sitelib}/%{srcname}/
%endif # with python3



%changelog
* Wed Apr  4 2018 Matthieu Saulnier <fantom@fedoraproject.org> - 1.1.1-1
- Initial package