summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2016-12-14 10:12:05 +0100
committerMartin Basti <mbasti@redhat.com>2017-01-06 12:48:10 +0100
commit35ba724de90b270773d91596de310291df745df0 (patch)
tree93c8e02f6228baaa0a65da5902a99ae068571f12
parentdeaad95247fa9624bef0108bf3813f358fb17ee5 (diff)
downloadfreeipa-35ba724de90b270773d91596de310291df745df0.tar.gz
freeipa-35ba724de90b270773d91596de310291df745df0.tar.xz
freeipa-35ba724de90b270773d91596de310291df745df0.zip
Py3: Fix ToASCII method
in Py2 to_text method returns Py2 non-unicode string, but in Py3 to_text method returns Py3 default (unicode) string. So only in Py2 we have to decode str to unicode. https://fedorahosted.org/freeipa/ticket/5935 Reviewed-By: Christian Heimes <cheimes@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
-rw-r--r--freeipa.spec.in20
-rw-r--r--ipapython/dnsutil.py11
-rw-r--r--ipasetup.py.in2
3 files changed, 19 insertions, 14 deletions
diff --git a/freeipa.spec.in b/freeipa.spec.in
index 443586634..c4420a0da 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -126,8 +126,8 @@ BuildRequires: python-memcached
BuildRequires: python-lxml
# 5.0.0: QRCode.print_ascii
BuildRequires: python-qrcode-core >= 5.0.0
-# 1.13: python-dns URI record support
-BuildRequires: python-dns >= 1.13
+# 1.15: python-dns changed return type in to_text() method in PY3
+BuildRequires: python-dns >= 1.15
BuildRequires: jsl
BuildRequires: python-yubico
# pki Python package
@@ -163,8 +163,8 @@ BuildRequires: python3-memcached
BuildRequires: python3-lxml
# 5.0.0: QRCode.print_ascii
BuildRequires: python3-qrcode-core >= 5.0.0
-# 1.13: python-dns URI record support
-BuildRequires: python3-dns >= 1.13
+# 1.15: python-dns changed return type in to_text() method in PY3
+BuildRequires: python3-dns >= 1.15
BuildRequires: python3-yubico
# pki Python package
# 10.2.1: crypto.NSSCryptoProvider(password_file)
@@ -294,7 +294,7 @@ Requires: python-gssapi >= 1.2.0
Requires: python-sssdconfig
Requires: python-pyasn1
Requires: dbus-python
-Requires: python-dns >= 1.13
+Requires: python-dns >= 1.15
Requires: python-kdcproxy >= 0.3
Requires: rpm-libs
@@ -323,7 +323,7 @@ Requires: python3-gssapi >= 1.2.0
Requires: python3-sssdconfig
Requires: python3-pyasn1
Requires: python3-dbus
-Requires: python3-dns >= 1.11.1
+Requires: python3-dns >= 1.15
Requires: python3-kdcproxy >= 0.3
Requires: rpm-libs
@@ -482,7 +482,7 @@ BuildArch: noarch
Requires: %{name}-client-common = %{version}-%{release}
Requires: %{name}-common = %{version}-%{release}
Requires: python2-ipalib = %{version}-%{release}
-Requires: python-dns >= 1.13
+Requires: python-dns >= 1.15
%description -n python2-ipaclient
IPA is an integrated solution to provide centrally managed Identity (users,
@@ -504,7 +504,7 @@ BuildArch: noarch
Requires: %{name}-client-common = %{version}-%{release}
Requires: %{name}-common = %{version}-%{release}
Requires: python3-ipalib = %{version}-%{release}
-Requires: python3-dns >= 1.11.1
+Requires: python3-dns >= 1.15
%description -n python3-ipaclient
IPA is an integrated solution to provide centrally managed Identity (users,
@@ -598,7 +598,7 @@ Requires: python-cffi
Requires: python-ldap >= 2.4.15
Requires: python-requests
Requires: python-custodia
-Requires: python-dns >= 1.13
+Requires: python-dns >= 1.15
Requires: python-enum34
Requires: python-netifaces >= 0.10.4
Requires: pyusb
@@ -648,7 +648,7 @@ Requires: python3-cffi
Requires: python3-pyldap >= 2.4.15
Requires: python3-custodia
Requires: python3-requests
-Requires: python3-dns >= 1.11.1
+Requires: python3-dns >= 1.15
Requires: python3-netifaces >= 0.10.4
Requires: python3-pyusb
diff --git a/ipapython/dnsutil.py b/ipapython/dnsutil.py
index 16549c8f6..011b722da 100644
--- a/ipapython/dnsutil.py
+++ b/ipapython/dnsutil.py
@@ -69,9 +69,14 @@ class DNSName(dns.name.Name):
def __str__(self):
return self.to_unicode()
- def ToASCII(self):
- #method named by RFC 3490 and python standard library
- return self.to_text().decode('ascii') # must be unicode string
+ # method ToASCII named by RFC 3490 and python standard library
+ if six.PY2:
+ def ToASCII(self):
+ # must be unicode string in Py2
+ return self.to_text().decode('ascii')
+ else:
+ def ToASCII(self):
+ return self.to_text()
def canonicalize(self):
return DNSName(super(DNSName, self).canonicalize())
diff --git a/ipasetup.py.in b/ipasetup.py.in
index 6a33fb86f..c221e0de6 100644
--- a/ipasetup.py.in
+++ b/ipasetup.py.in
@@ -64,7 +64,7 @@ if SETUPTOOLS_VERSION < (8, 0, 0):
PACKAGE_VERSION = {
'cryptography': 'cryptography >= 1.3.1',
- 'dnspython': 'dnspython >= 1.13',
+ 'dnspython': 'dnspython >= 1.15',
'gssapi': 'gssapi >= 1.2.0',
'ipaclient': 'ipaclient == {}'.format(VERSION),
'ipalib': 'ipalib == {}'.format(VERSION),