-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added py3dns recipe * Update py3dns recipe
- Loading branch information
1 parent
92cb8f4
commit 9670576
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from pythonforandroid.recipe import PythonRecipe | ||
|
||
|
||
class Py3DNSRecipe(PythonRecipe): | ||
site_packages_name = 'DNS' | ||
version = '3.2.1' | ||
url = 'https://launchpad.net/py3dns/trunk/{version}/+download/py3dns-{version}.tar.gz' | ||
depends = ['setuptools'] | ||
patches = ['patches/android.patch'] | ||
call_hostpython_via_targetpython = False | ||
|
||
|
||
recipe = Py3DNSRecipe() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
diff --git a/DNS/Base.py b/DNS/Base.py | ||
index 34a6da7..a558889 100644 | ||
--- a/DNS/Base.py | ||
+++ b/DNS/Base.py | ||
@@ -15,6 +15,7 @@ import socket, string, types, time, select | ||
import errno | ||
from . import Type,Class,Opcode | ||
import asyncore | ||
+import os | ||
# | ||
# This random generator is used for transaction ids and port selection. This | ||
# is important to prevent spurious results from lost packets, and malicious | ||
@@ -50,8 +51,12 @@ defaults= { 'protocol':'udp', 'port':53, 'opcode':Opcode.QUERY, | ||
|
||
def ParseResolvConf(resolv_path="/etc/resolv.conf"): | ||
"parses the /etc/resolv.conf file and sets defaults for name servers" | ||
- with open(resolv_path, 'r') as stream: | ||
- return ParseResolvConfFromIterable(stream) | ||
+ if os.path.exists(resolv_path): | ||
+ with open(resolv_path, 'r') as stream: | ||
+ return ParseResolvConfFromIterable(stream) | ||
+ else: | ||
+ defaults['server'].append('127.0.0.1') | ||
+ return | ||
|
||
def ParseResolvConfFromIterable(lines): | ||
"parses a resolv.conf formatted stream and sets defaults for name servers" |