25738f9
# set upstream name variable
25738f9
%global srcname pycares
25738f9
25738f9
25738f9
%if 0%{?fedora}
25738f9
%bcond_without python3
25738f9
%else
25738f9
%bcond_with python3
25738f9
%endif
25738f9
25738f9
Name:           python-pycares
25738f9
Version:        2.3.0
0b51041
Release:        5%{?dist}
25738f9
Summary:        Python interface for c-ares
25738f9
25738f9
License:        MIT
25738f9
URL:            https://github.com/saghul/pycares
25738f9
Source0:        https://github.com/saghul/%{srcname}/archive/%{srcname}-%{version}.tar.gz
25738f9
921a2f9
BuildRequires:  gcc
25738f9
BuildRequires:  python2-devel
25738f9
# for docs
25738f9
BuildRequires:  python2-sphinx
25738f9
%if %{with python3}
25738f9
BuildRequires:  python3-devel
25738f9
%endif # with python3
25738f9
25738f9
%description
25738f9
pycares is a Python module which provides an interface to
25738f9
c-ares. c-ares is a C library that performs DNS requests and name
25738f9
resolutions asynchronously.
25738f9
25738f9
25738f9
%package     -n python2-%{srcname}
25738f9
Summary:        Python interface for c-ares
25738f9
%{?python_provide:%python_provide python2-%{srcname}}
25738f9
25738f9
%description -n python2-%{srcname}
25738f9
pycares is a Python module which provides an interface to
25738f9
c-ares. c-ares is a C library that performs DNS requests and name
25738f9
resolutions asynchronously.
25738f9
25738f9
25738f9
%if %{with python3}
25738f9
%package     -n python3-%{srcname}
25738f9
Summary:        Python interface for c-ares
25738f9
%{?python_provide:%python_provide python3-%{srcname}}
25738f9
25738f9
%description -n python3-%{srcname}
25738f9
pycares is a Python module which provides an interface to
25738f9
c-ares. c-ares is a C library that performs DNS requests and name
25738f9
resolutions asynchronously.
25738f9
%endif # with python3
25738f9
25738f9
25738f9
%package     -n python-%{srcname}-doc
25738f9
Summary:        Documentation for python-pycares
25738f9
BuildArch:      noarch
25738f9
Requires:       python2-%{srcname}
25738f9
25738f9
%description -n python-%{srcname}-doc
25738f9
pycares is a Python module which provides an interface to
25738f9
c-ares. c-ares is a C library that performs DNS requests and name
25738f9
resolutions asynchronously.
25738f9
25738f9
This package contains documentation in reST and HTML formats.
25738f9
25738f9
25738f9
25738f9
%prep
25738f9
%autosetup -n %{srcname}-%{srcname}-%{version}
25738f9
25738f9
25738f9
%build
25738f9
%py2_build
25738f9
25738f9
%if %{with python3}
25738f9
%py3_build
25738f9
%endif # with python3
25738f9
25738f9
# Build sphinx documentation
25738f9
pushd docs/
25738f9
make html
25738f9
popd # docs
25738f9
25738f9
25738f9
%install
25738f9
# Must do the python3 install first because the scripts in /usr/bin are
25738f9
# overwritten with every setup.py install (and we want the python2 version
25738f9
# to be the default for now).
25738f9
%if %{with python3}
25738f9
%py3_install
25738f9
%endif # with python3
25738f9
%py2_install
25738f9
25738f9
# Install html docs
25738f9
mkdir -p %{buildroot}%{_pkgdocdir}/
25738f9
cp -pr docs/_build/html %{buildroot}%{_pkgdocdir}/
25738f9
25738f9
# Move sources
25738f9
mv -f %{buildroot}%{_pkgdocdir}/html/_sources/ %{buildroot}%{_pkgdocdir}/rst/
25738f9
25738f9
# Remove buildinfo sphinx documentation
25738f9
rm -rf %{buildroot}%{_pkgdocdir}/html/.buildinfo
25738f9
25738f9
# Fix non-standard modes (775)
25738f9
chmod 755 %{buildroot}%{python2_sitearch}/%{srcname}/_core.so
25738f9
chmod 755 %{buildroot}%{python3_sitearch}/%{srcname}/_core.cpython-*.so
25738f9
25738f9
25738f9
%check
25738f9
%{__python2} setup.py test -s pycares._core
25738f9
25738f9
%if %{with python3}
25738f9
%{__python3} setup.py test -s pycares._core
25738f9
%endif
25738f9
25738f9
25738f9
25738f9
%files -n python2-%{srcname}
25738f9
%license LICENSE
25738f9
%doc README.rst ChangeLog
25738f9
# For arch-specific packages: sitearch
25738f9
%{python2_sitearch}/%{srcname}/
25738f9
%{python2_sitearch}/%{srcname}-%{version}-*.egg-info/
25738f9
25738f9
25738f9
%if %{with python3}
25738f9
%files -n python3-%{srcname}
25738f9
%license LICENSE
25738f9
%doc README.rst ChangeLog
25738f9
# For arch-specific packages: sitearch
25738f9
%{python3_sitearch}/%{srcname}/
25738f9
%{python3_sitearch}/%{srcname}-%{version}-*.egg-info/
25738f9
%endif # with python3
25738f9
25738f9
25738f9
%files -n python-%{srcname}-doc
25738f9
%doc examples/
25738f9
%{_pkgdocdir}/
25738f9
25738f9
25738f9
25738f9
%changelog
0b51041
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-5
0b51041
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
0b51041
97ce98a
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.0-4
97ce98a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
97ce98a
e2750b0
* Tue Jun 19 2018 Miro HronĨok <mhroncok@redhat.com> - 2.3.0-3
e2750b0
- Rebuilt for Python 3.7
e2750b0
25738f9
* Wed Apr  4 2018 Matthieu Saulnier <fantom@fedoraproject.org> - 2.3.0-2
25738f9
- Remove useless code duplication step
25738f9
- Add missing %%python_provide macro in subpackages
25738f9
- Cleanup rst doc script in %%install section
25738f9
- Fix file ownership in doc subpackage
25738f9
25738f9
* Mon Apr  2 2018 Matthieu Saulnier <fantom@fedoraproject.org> - 2.3.0-1
25738f9
- Initial package