- Latest Release
- Cleanup spec - Patch to fix unicode escapes - Drop el6 from master (el6 requires patch for 1.16.0)
This commit is contained in:
parent
877c013bf3
commit
8a3e232332
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,3 +21,4 @@
|
||||
/dnspython3-1.12.0GIT99fd864.tar.gz
|
||||
/dnspython-1.12.0GIT99fd864.tar.gz
|
||||
/dnspython-1.15.0.tar.gz
|
||||
/dnspython-1.16.0.tar.gz
|
||||
|
230
python-dns.spec
230
python-dns.spec
@ -1,63 +1,52 @@
|
||||
# __python2 macro doesn't exist for el6
|
||||
%if 0%{?rhel} == 6
|
||||
%global __python2 %{__python}
|
||||
%global python2_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
|
||||
%endif
|
||||
%global pypi_name dnspython
|
||||
%global py_package_name dns
|
||||
%global summary DNS toolkit for Python
|
||||
%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. \
|
||||
|
||||
%if 0%{?epel} > 6
|
||||
# Do not build python2 package for EPEL7+ since it's included in RHEL
|
||||
%global with_python2 0
|
||||
# Rename source package so it doesn't conflict with RHEL source package
|
||||
%global srpm_py_suffix 3
|
||||
# Disable dependency generator until it has test code
|
||||
%{?python_disable_dependency_generator}
|
||||
|
||||
%bcond_without python3
|
||||
|
||||
# Drop Python 2 with Fedora 32 and EL8
|
||||
%if (0%{?fedora} && 0%{?fedora} < 32) || (0%{?rhel} && 0%{?rhel} < 8)
|
||||
%bcond_without python2
|
||||
%else
|
||||
%global with_python2 1
|
||||
|
||||
# Rename to python2-dns after Fedora 23
|
||||
%if 0%{?fedora} > 23 || 0%{?rhel} > 7
|
||||
%global with_p2subpkg 1
|
||||
%global python2_pkgversion 2
|
||||
%else
|
||||
%global python2_pkgversion %{nil}
|
||||
%endif
|
||||
%bcond_with python2
|
||||
%endif
|
||||
|
||||
# Build python3 package for Fedora and EPEL7+
|
||||
%if 0%{?fedora} > 12 || 0%{?epel} > 6 || 0%{?rhel} > 7
|
||||
%global with_python3 1
|
||||
%{!?python3_pkgversion: %global python3_pkgversion 3}
|
||||
%endif
|
||||
|
||||
Name: python%{?srpm_py_suffix}-dns
|
||||
Version: 1.15.0
|
||||
Release: 11%{?dist}
|
||||
Summary: DNS toolkit for Python
|
||||
Name: python-%{py_package_name}
|
||||
Version: 1.16.0
|
||||
Release: 1%{?dist}
|
||||
Summary: %{summary}
|
||||
|
||||
License: MIT
|
||||
URL: http://www.dnspython.org/
|
||||
URL: http://www.dnspython.org
|
||||
|
||||
Source0: http://www.dnspython.org/kits/%{version}/dnspython-%{version}.tar.gz
|
||||
Source0: http://www.dnspython.org/kits/%{version}/%{pypi_name}-%{version}.tar.gz
|
||||
|
||||
BuildArch: noarch
|
||||
Patch0: test_fails_on_missing_file.patch
|
||||
#Patch0: unicode_label_escapify.patch
|
||||
|
||||
%if 0%{?rhel} == 6
|
||||
BuildRequires: python-unittest2
|
||||
%endif
|
||||
|
||||
# If python2-package
|
||||
%if 0%{?with_p2subpkg}
|
||||
%if %{with python2}
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python2-setuptools
|
||||
BuildRequires: python2-typing
|
||||
BuildRequires: python2-crypto
|
||||
# If python2 but no python2-package
|
||||
%else
|
||||
%if 0%{?with_python2}
|
||||
Provides: python2-dns = %{version}-%{release}
|
||||
Requires: python-crypto
|
||||
BuildRequires: python-devel
|
||||
BuildRequires: python-setuptools
|
||||
BuildRequires: python-crypto
|
||||
%endif
|
||||
|
||||
%if %{with python3}
|
||||
BuildRequires: python%{python3_pkgversion}-devel
|
||||
BuildRequires: python%{python3_pkgversion}-setuptools
|
||||
BuildRequires: python%{python3_pkgversion}-crypto
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
@ -66,105 +55,130 @@ BuildRequires: python%{python3_pkgversion}-setuptools
|
||||
BuildRequires: python%{python3_pkgversion}-crypto
|
||||
%endif
|
||||
|
||||
%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.
|
||||
%if 0%{?with_python3_other}
|
||||
BuildRequires: python%{python3_other_pkgversion}-devel
|
||||
BuildRequires: python%{python3_other_pkgversion}-setuptools
|
||||
BuildRequires: python%{python3_other_pkgversion}-crypto
|
||||
%endif
|
||||
|
||||
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.
|
||||
%description %{_description}
|
||||
|
||||
|
||||
# Python 2 package
|
||||
%if %{with python2}
|
||||
%package -n python2-%{py_package_name}
|
||||
Summary: %{summary}
|
||||
%{?python_provide:%python_provide python2-%{py_package_name}}
|
||||
|
||||
%if 0%{?with_p2subpkg}
|
||||
%package -n python2-dns
|
||||
Summary: DNS toolkit for Python 2
|
||||
%{?python_provide:%python_provide python2-dns}
|
||||
Requires: python2-crypto
|
||||
|
||||
%description -n python2-dns
|
||||
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.
|
||||
%description -n python2-%{py_package_name} %{_description}
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%package -n python%{python3_pkgversion}-dns
|
||||
Summary: DNS toolkit for Python 3
|
||||
%{?python_provide:%python_provide python%{python3_pkgversion}-dns}
|
||||
# Python 3 package
|
||||
%if %{with python3}
|
||||
%package -n python%{python3_pkgversion}-%{py_package_name}
|
||||
Summary: %{summary}
|
||||
%{?python_provide:%python_provide python%{python3_pkgversion}-%{py_package_name}}
|
||||
|
||||
Requires: python%{python3_pkgversion}-crypto
|
||||
|
||||
%description -n python%{python3_pkgversion}-dns
|
||||
dnspython3 is a DNS toolkit for Python 3. It supports almost all
|
||||
record types. It can be used for queries, zone transfers, and dynamic
|
||||
updates. It supports TSIG authenticated messages and EDNS0.
|
||||
|
||||
dnspython3 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.
|
||||
%description -n python%{python3_pkgversion}-%{py_package_name} %{_description}
|
||||
%endif
|
||||
|
||||
# Python 3 other package
|
||||
%if 0%{?with_python3_other}
|
||||
%package -n python%{python3_other_pkgversion}-%{py_package_name}
|
||||
Summary: %{summary}
|
||||
%{?python_provide:%python_provide python%{python3_other_pkgversion}-%{py_package_name}}
|
||||
|
||||
Requires: python%{python3_other_pkgversion}-crypto
|
||||
|
||||
%description -n python%{python3_other_pkgversion}-%{py_package_name} %{_description}
|
||||
%endif
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n dnspython-%{version}
|
||||
%patch0 -p1
|
||||
%autosetup -p1 -n %{pypi_name}-%{version}
|
||||
|
||||
# strip exec permissions so that we don't pick up dependencies from docs
|
||||
find examples -type f | xargs chmod a-x
|
||||
|
||||
|
||||
%build
|
||||
%if 0%{?with_python2}
|
||||
%if %{with python2}
|
||||
%py2_build
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%if %{with python3}
|
||||
%py3_build
|
||||
%endif
|
||||
|
||||
%install
|
||||
%if 0%{?with_python2}
|
||||
%py2_install
|
||||
%if 0%{?with_python3_other}
|
||||
%py3_other_build
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
|
||||
%install
|
||||
%if 0%{?with_python3_other}
|
||||
%py3_other_install
|
||||
%endif
|
||||
|
||||
%if %{with python3}
|
||||
%py3_install
|
||||
%endif
|
||||
|
||||
%if %{with python2}
|
||||
%py2_install
|
||||
%endif
|
||||
|
||||
|
||||
%check
|
||||
%if 0%{?with_python2}
|
||||
%{__python2} setup.py test
|
||||
%if %{with python2}
|
||||
%{__python2} setup.py test
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%{__python3} setup.py test
|
||||
%if %{with python3}
|
||||
%{__python3} setup.py test
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python2}
|
||||
%if 0%{?with_p2subpkg}
|
||||
%files -n python2-dns
|
||||
%else
|
||||
%files
|
||||
%endif
|
||||
# Add README.* when it is included with the source (commit a906279)
|
||||
%doc {ChangeLog,LICENSE,examples}
|
||||
%{python2_sitelib}/*egg-info
|
||||
%{python2_sitelib}/dns
|
||||
%if 0%{?with_python3_other}
|
||||
%{__python3_other} setup.py test
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%files -n python%{python3_pkgversion}-dns
|
||||
# Add README.* when it is included with the source (commit a906279)
|
||||
%doc {ChangeLog,LICENSE,examples}
|
||||
%{python3_sitelib}/*egg-info
|
||||
%{python3_sitelib}/dns
|
||||
|
||||
%if %{with python2}
|
||||
%files -n python2-%{py_package_name}
|
||||
%license LICENSE
|
||||
%doc README.md examples
|
||||
%{python2_sitelib}/%{py_package_name}
|
||||
%{python2_sitelib}/%{pypi_name}-*.egg-info
|
||||
%endif
|
||||
|
||||
%if %{with python3}
|
||||
%files -n python%{python3_pkgversion}-%{py_package_name}
|
||||
%license LICENSE
|
||||
%doc README.md examples
|
||||
%{python3_sitelib}/%{py_package_name}
|
||||
%{python3_sitelib}/%{pypi_name}-*.egg-info
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3_other}
|
||||
%files -n python%{python3_other_pkgversion}-%{py_package_name}
|
||||
%license LICENSE
|
||||
%doc README.md examples
|
||||
%{python3_other_sitelib}/%{py_package_name}
|
||||
%{python3_other_sitelib}/%{pypi_name}-*.egg-info
|
||||
%endif
|
||||
|
||||
|
||||
%changelog
|
||||
* Sat Jul 27 2019 Avram Lubkin <aviso@fedoraproject.org> - 1.16.0-1
|
||||
- Latest Release
|
||||
- Cleanup spec
|
||||
- Patch to fix unicode escapes
|
||||
- Drop el6 from master (el6 requires patch for 1.16.0)
|
||||
|
||||
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.15.0-11
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
63a679089822fb86127867c315286dc5 dnspython-1.15.0.tar.gz
|
||||
SHA512 (dnspython-1.16.0.tar.gz) = 41ddca2faf696d5d682551f517efd90c007011c1f6d9355d297d71a3fe84222a1e528945343d8c2276ad3957ceaab578f3df7c2c1709418ffcca01ccbb379359
|
||||
|
@ -1,12 +0,0 @@
|
||||
diff -ruN /home/avram/Desktop/dnspython-1.15.0.orig/tests/test_zone.py /home/avram/Desktop/dnspython-1.15.0/tests/test_zone.py
|
||||
--- a/tests/test_zone.py 2016-09-20 12:24:02.000000000 -0400
|
||||
+++ b/tests/test_zone.py 2016-10-04 07:59:39.717946790 -0400
|
||||
@@ -177,7 +177,7 @@
|
||||
def testToFileFilename(self):
|
||||
z = dns.zone.from_file(here('example'), 'example')
|
||||
try:
|
||||
- z.to_file('example3-filename.out')
|
||||
+ z.to_file(here('example3-filename.out'))
|
||||
ok = filecmp.cmp(here('example3-filename.out'),
|
||||
here('example3.good'))
|
||||
finally:
|
84
unicode_label_escapify.patch
Normal file
84
unicode_label_escapify.patch
Normal file
@ -0,0 +1,84 @@
|
||||
diff -ru dnspython-1.16.0-orig/dns/name.py dnspython-1.16.0/dns/name.py
|
||||
--- dnspython-1.16.0-orig/dns/name.py 2018-12-05 08:35:40.000000000 -0500
|
||||
+++ dnspython-1.16.0/dns/name.py 2019-07-28 08:48:37.893331388 -0400
|
||||
@@ -110,15 +110,23 @@
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
+ def is_idna(self, label):
|
||||
+ return label.lower().startswith(b'xn--')
|
||||
+
|
||||
+ def is_all_ascii(self, label):
|
||||
+ for c in label:
|
||||
+ if ord(c) > 0x7f:
|
||||
+ return False
|
||||
+ return True
|
||||
+
|
||||
def encode(self, label):
|
||||
raise NotImplementedError
|
||||
|
||||
def decode(self, label):
|
||||
- # We do not apply any IDNA policy on decode; we just
|
||||
- downcased = label.lower()
|
||||
- if downcased.startswith(b'xn--'):
|
||||
+ # We do not apply any IDNA policy on decode.
|
||||
+ if self.is_idna(label):
|
||||
try:
|
||||
- label = downcased[4:].decode('punycode')
|
||||
+ label = label[4:].decode('punycode')
|
||||
except Exception as e:
|
||||
raise IDNAException(idna_exception=e)
|
||||
else:
|
||||
@@ -195,12 +203,6 @@
|
||||
self.allow_pure_ascii = allow_pure_ascii
|
||||
self.strict_decode = strict_decode
|
||||
|
||||
- def is_all_ascii(self, label):
|
||||
- for c in label:
|
||||
- if ord(c) > 0x7f:
|
||||
- return False
|
||||
- return True
|
||||
-
|
||||
def encode(self, label):
|
||||
if label == '':
|
||||
return b''
|
||||
@@ -230,6 +232,7 @@
|
||||
raise IDNAException(idna_exception=e)
|
||||
|
||||
_escaped = bytearray(b'"().;\\@$')
|
||||
+_escaped_text = u'"().;\\@$'
|
||||
|
||||
IDNA_2003_Practical = IDNA2003Codec(False)
|
||||
IDNA_2003_Strict = IDNA2003Codec(True)
|
||||
@@ -265,11 +268,12 @@
|
||||
for c in label:
|
||||
if c > u'\x20' and c < u'\x7f':
|
||||
text += c
|
||||
+ if c in _escaped_text:
|
||||
+ text += '\\' + c
|
||||
+ elif c <= '\x20':
|
||||
+ text += '\\%03d' % ord(c)
|
||||
else:
|
||||
- if c >= u'\x7f':
|
||||
- text += c
|
||||
- else:
|
||||
- text += u'\\%03d' % ord(c)
|
||||
+ tect += c
|
||||
return text
|
||||
|
||||
def _validate_labels(labels):
|
||||
diff -ru dnspython-1.16.0-orig/tests/test_name.py dnspython-1.16.0/tests/test_name.py
|
||||
--- dnspython-1.16.0-orig/tests/test_name.py 2018-12-01 10:48:40.000000000 -0500
|
||||
+++ dnspython-1.16.0/tests/test_name.py 2019-07-28 08:52:46.831657776 -0400
|
||||
@@ -255,6 +255,11 @@
|
||||
t = dns.name.root.to_unicode()
|
||||
self.assertEqual(t, '.')
|
||||
|
||||
+ def testToText12(self):
|
||||
+ n = dns.name.from_text(r'a\.b.c')
|
||||
+ t = n.to_unicode()
|
||||
+ self.assertEqual(t, r'a\.b.c.')
|
||||
+
|
||||
def testSlice1(self):
|
||||
n = dns.name.from_text(r'a.b.c.', origin=None)
|
||||
s = n[:]
|
Loading…
Reference in New Issue
Block a user