tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
pythonPackages.sleekxmpp: fix dnspython issue
Robin Gloster
7 years ago
6f76d907
bf2e5123
+78
2 changed files
expand all
collapse all
unified
split
pkgs
development
python-modules
sleekxmpp
default.nix
dnspython-ip6.patch
+23
pkgs/development/python-modules/sleekxmpp/default.nix
···
1
1
+
{ stdenv, fetchurl, buildPythonPackage, dns, pyasn1 }:
2
2
+
3
3
+
buildPythonPackage rec {
4
4
+
name = "sleekxmpp-${version}";
5
5
+
version = "1.3.1";
6
6
+
7
7
+
propagatedBuildInputs = [ dns pyasn1 ];
8
8
+
9
9
+
patches = [
10
10
+
./dnspython-ip6.patch
11
11
+
];
12
12
+
13
13
+
src = fetchurl {
14
14
+
url = "mirror://pypi/s/sleekxmpp/${name}.tar.gz";
15
15
+
sha256 = "1krkhkvj8xw5a6c2xlf7h1rg9xdcm9d8x2niivwjahahpvbl6krr";
16
16
+
};
17
17
+
18
18
+
meta = with stdenv.lib; {
19
19
+
description = "XMPP library for Python";
20
20
+
license = licenses.mit;
21
21
+
homepage = "http://sleekxmpp.com/";
22
22
+
};
23
23
+
}
+55
pkgs/development/python-modules/sleekxmpp/dnspython-ip6.patch
···
1
1
+
--- a/sleekxmpp/xmlstream/resolver.py
2
2
+
+++ b/sleekxmpp/xmlstream/resolver.py
3
3
+
@@ -175,6 +175,9 @@ def get_A(host, resolver=None, use_dnspy
4
4
+
"""
5
5
+
log.debug("DNS: Querying %s for A records." % host)
6
6
+
7
7
+
+ if isinstance(host, bytes):
8
8
+
+ host = host.decode("utf-8")
9
9
+
+
10
10
+
# If not using dnspython, attempt lookup using the OS level
11
11
+
# getaddrinfo() method.
12
12
+
if resolver is None or not use_dnspython:
13
13
+
@@ -189,7 +192,10 @@ def get_A(host, resolver=None, use_dnspy
14
14
+
# Using dnspython:
15
15
+
try:
16
16
+
recs = resolver.query(host, dns.rdatatype.A)
17
17
+
- return [rec.to_text() for rec in recs]
18
18
+
+ if isinstance(recs[0].to_text(), bytes):
19
19
+
+ return [rec.to_text().decode("utf-8") for rec in recs]
20
20
+
+ else:
21
21
+
+ return [rec.to_text() for rec in recs]
22
22
+
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
23
23
+
log.debug("DNS: No A records for %s" % host)
24
24
+
return []
25
25
+
@@ -222,6 +228,9 @@ def get_AAAA(host, resolver=None, use_dn
26
26
+
"""
27
27
+
log.debug("DNS: Querying %s for AAAA records." % host)
28
28
+
29
29
+
+ if isinstance(host, bytes):
30
30
+
+ host = host.decode("utf-8")
31
31
+
+
32
32
+
# If not using dnspython, attempt lookup using the OS level
33
33
+
# getaddrinfo() method.
34
34
+
if resolver is None or not use_dnspython:
35
35
+
@@ -240,7 +249,10 @@ def get_AAAA(host, resolver=None, use_dn
36
36
+
# Using dnspython:
37
37
+
try:
38
38
+
recs = resolver.query(host, dns.rdatatype.AAAA)
39
39
+
- return [rec.to_text() for rec in recs]
40
40
+
+ if isinstance(recs[0].to_text(), bytes):
41
41
+
+ return [rec.to_text().decode("utf-8") for rec in recs]
42
42
+
+ else:
43
43
+
+ return [rec.to_text() for rec in recs]
44
44
+
except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
45
45
+
log.debug("DNS: No AAAA records for %s" % host)
46
46
+
return []
47
47
+
@@ -324,6 +336,8 @@ def get_SRV(host, port, service, proto='
48
48
+
if running_sum >= selected:
49
49
+
rec = sums[running_sum]
50
50
+
host = rec.target.to_text()
51
51
+
+ if isinstance(host, bytes):
52
52
+
+ host = host.decode("utf-8")
53
53
+
if host.endswith('.'):
54
54
+
host = host[:-1]
55
55
+
sorted_recs.append((host, rec.port))