-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added py3dns recipe #2590
Merged
Merged
Added py3dns recipe #2590
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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://github.com/Neizvestnyj/py3dns/archive/{version}.zip' | ||
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,21 @@ | ||
diff --git a/DNS/Base.py b/DNS/Base.py | ||
index 34a6da7..15f83a2 100644 | ||
--- a/DNS/Base.py | ||
+++ b/DNS/Base.py | ||
@@ -49,9 +49,13 @@ defaults= { 'protocol':'udp', 'port':53, 'opcode':Opcode.QUERY, | ||
'server': [] } | ||
|
||
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) | ||
+ try: | ||
+ "parses the /etc/resolv.conf file and sets defaults for name servers" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't matter too much, but docstring could stay where it was instead of being in the try/except block There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
+ with open(resolv_path, 'r') as stream: | ||
+ return ParseResolvConfFromIterable(stream) | ||
+ except FileNotFoundError: | ||
+ defaults['server'].append('127.0.0.1') | ||
+ return | ||
|
||
def ParseResolvConfFromIterable(lines): | ||
"parses a resolv.conf formatted stream and sets defaults for name servers" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using the official launchpad download link instead?
https://launchpad.net/py3dns/trunk/3.2.1/+download/py3dns-3.2.1.tar.gz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, well, I didn't think about it. py3dns works fine and does not require any changes yet. It's just that there is such a bug on android. The last
validate_email
release was in 2015 :)