Skip to content

Commit bc03538

Browse files
committed
Added py3dns recipe
1 parent fe5d722 commit bc03538

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from pythonforandroid.recipe import PythonRecipe
2+
3+
4+
class Py3DNSRecipe(PythonRecipe):
5+
site_packages_name = 'DNS'
6+
version = '3.2.1'
7+
url = 'https://github.com/Neizvestnyj/py3dns/archive/{version}.zip'
8+
depends = ['setuptools']
9+
patches = ['patches/android.patch']
10+
call_hostpython_via_targetpython = False
11+
12+
13+
recipe = Py3DNSRecipe()
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/DNS/Base.py b/DNS/Base.py
2+
index 34a6da7..15f83a2 100644
3+
--- a/DNS/Base.py
4+
+++ b/DNS/Base.py
5+
@@ -49,9 +49,13 @@ defaults= { 'protocol':'udp', 'port':53, 'opcode':Opcode.QUERY,
6+
'server': [] }
7+
8+
def ParseResolvConf(resolv_path="/etc/resolv.conf"):
9+
- "parses the /etc/resolv.conf file and sets defaults for name servers"
10+
- with open(resolv_path, 'r') as stream:
11+
- return ParseResolvConfFromIterable(stream)
12+
+ try:
13+
+ "parses the /etc/resolv.conf file and sets defaults for name servers"
14+
+ with open(resolv_path, 'r') as stream:
15+
+ return ParseResolvConfFromIterable(stream)
16+
+ except FileNotFoundError:
17+
+ defaults['server'].append('127.0.0.1')
18+
+ return
19+
20+
def ParseResolvConfFromIterable(lines):
21+
"parses a resolv.conf formatted stream and sets defaults for name servers"

0 commit comments

Comments
 (0)