%global _description \
dnspython is a DNS toolkit for Python. It supports \
almost all record types. It can be used for queries, \
zone transfers, and dynamic updates. It supports TSIG \
authenticated messages and EDNS0.\
dnspython provides both high and low level access to DNS. \
The high level classes perform queries for data of a given \
name, type, and class, and return an answer set. The low \
level classes allow direct manipulation of DNS zones, \
messages, names, and records.

%global sum DNS toolkit for Python

Name:           python-dns
Summary:        %{sum}
Version:        2.8.0
Release:        2
License:        ISC and MIT
URL:            http://www.dnspython.org/
Source0:        https://github.com/rthalley/dnspython/archive/v%{version}/dnspython-%{version}.tar.gz

Patch0009:      fix-to-skip-unsupport-testcases.patch
Patch0010:      remove-idna-transitional-testcases.patch

BuildArch:      noarch

BuildRequires:  python3-devel python3-setuptools python3-cryptography
BuildRequires:  python3-pytest
BuildRequires:  pyproject-rpm-macros python3-hatchling python3-pip

%description
%{_description}

%package     -n python3-dns
Summary:        %{sum}
%{?python_provide:%python_provide python3-dns}
Requires:       python3-cryptography

%description -n python3-dns
%{_description}

%package_help

%prep
%autosetup -p1 -n dnspython-%{version}
find examples -type f | xargs chmod a-x

%build
%pyproject_wheel

%install
%pyproject3_install
%pyproject_save_files dns

%check
if [ "root" == "$(whoami)" ];then
	#8.8.8.8 nameserver can support CNAME better
        sed -i "1 a nameserver 8.8.8.8" /etc/resolv.conf
        pytest
        sed -i "2d" /etc/resolv.conf
else
        pytest
fi

%files -n python3-dns -f %{pyproject_files}
%doc LICENSE

%files help
%doc examples

%changelog
* Sun Oct 18 2026 Funda Wang <fundawang@yeah.net> - 2.8.0-2
- remove IDNA transitional testcases which fail with idna >= 3.11

* Fri Feb 06 2026 gaihuiying <eaglegai@163.com> - 2.8.0-1
- update python-dns to 2.8.0

* Wed Mar 19 2025 gaihuiying <eaglegai@163.com> - 2.6.1-1
- update python-dns to 2.6.1

* Mon Dec 02 2024 gaihuiying <eaglegai@163.com> - 2.4.2-3
- fix building error

* Thu Apr 18 2024 wangguochun <wangguochun@kylinos.cn> - 2.4.2-2
- fix CVE-2023-29483

* Tue Dec 26 2023 gaihuiying <eaglegai@163.com> - 2.4.2-1
- update to 2.4.2

* Wed Apr 19 2023 ChenYanpan <chenyanpan@xfusion.com> - 2.3.0-3
- Fixed the missing Patch1 in spec

* Tue Apr 18 2023 ChenYanpan <chenyanpan@xfusion.com> - 2.3.0-2
- Add dns.quic to setup.cfg for legacy setup.py installs

* Sat Mar 11 2023 gaihuiying <eaglegai@163.com> - 2.3.0-1
- update to 2.3.0

* Fri Jan 13 2023 caofei <caofei@xfusion.com> -  2.2.1-3
- update README w/ codecov and lgtm

* Mon Jan 9 2023 caofei <caofei@xfusion.com> - 2.2.1-2
- fix win32util.py file mode

* Thu Oct 27 2022 gaihuiying <eaglegai@163.com> - 2.2.1-1
- update to 2.2.1

* Sat Jan 08 2022 quanhongfei<quanhongfei@huawei.com> - 2.1.0-2
- fix tests failed

* Fri Dec 10 2021 gaihuiying<gaihuiying1@huawei.com> - 2.1.0-1
- update to 2.1.0

* Tue Nov 17 2020 jinzhimin<jinzhimin2@huawei.com> - 1.16.0-3
- fix tests failed

* Tue Nov 10 2020 jinzhimin<jinzhimin2@huawei.com> - 1.16.0-2
- fix the network tests failed

* Tue Nov 10 2020 jinzhimin<jinzhimin2@huawei.com> - 1.16.0-1
- update to 1.16.0

* Wed Oct 21 2020 jinzhimin<jinzhimin2@huawei.com> - 1.15.0-11
- remove python2-dns subpackage

* Fri Dec 6 2019 caomeng<caomeng5@huawei.com> - 1.15.0-10
- Package init