Skip to content

Commit 625ecbd

Browse files
committed
Update py3dns recipe
1 parent bc03538 commit 625ecbd

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

pythonforandroid/recipes/py3dns/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
class Py3DNSRecipe(PythonRecipe):
55
site_packages_name = 'DNS'
66
version = '3.2.1'
7-
url = 'https://github.com/Neizvestnyj/py3dns/archive/{version}.zip'
7+
url = 'https://launchpad.net/py3dns/trunk/{version}/+download/py3dns-{version}.tar.gz'
88
depends = ['setuptools']
99
patches = ['patches/android.patch']
1010
call_hostpython_via_targetpython = False

pythonforandroid/recipes/py3dns/patches/android.patch

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
diff --git a/DNS/Base.py b/DNS/Base.py
2-
index 34a6da7..15f83a2 100644
2+
index 34a6da7..a558889 100644
33
--- a/DNS/Base.py
44
+++ b/DNS/Base.py
5-
@@ -49,9 +49,13 @@ defaults= { 'protocol':'udp', 'port':53, 'opcode':Opcode.QUERY,
6-
'server': [] }
5+
@@ -15,6 +15,7 @@ import socket, string, types, time, select
6+
import errno
7+
from . import Type,Class,Opcode
8+
import asyncore
9+
+import os
10+
#
11+
# This random generator is used for transaction ids and port selection. This
12+
# is important to prevent spurious results from lost packets, and malicious
13+
@@ -50,8 +51,12 @@ defaults= { 'protocol':'udp', 'port':53, 'opcode':Opcode.QUERY,
714

815
def ParseResolvConf(resolv_path="/etc/resolv.conf"):
9-
- "parses the /etc/resolv.conf file and sets defaults for name servers"
16+
"parses the /etc/resolv.conf file and sets defaults for name servers"
1017
- with open(resolv_path, 'r') as stream:
1118
- return ParseResolvConfFromIterable(stream)
12-
+ try:
13-
+ "parses the /etc/resolv.conf file and sets defaults for name servers"
19+
+ if os.path.exists(resolv_path):
1420
+ with open(resolv_path, 'r') as stream:
1521
+ return ParseResolvConfFromIterable(stream)
16-
+ except FileNotFoundError:
22+
+ else:
1723
+ defaults['server'].append('127.0.0.1')
1824
+ return
1925

0 commit comments

Comments
 (0)