Skip to content
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 #728

Merged
merged 5 commits into from
Jul 10, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions kivy_ios/recipes/py3dns/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from kivy_ios.toolchain 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 = ['host_setuptools3']

def prebuild_arch(self, arch):
if self.has_marker("patched"):
return

self.apply_patch("ios.patch")
self.set_marker("patched")


recipe = Py3DNSRecipe()
27 changes: 27 additions & 0 deletions kivy_ios/recipes/py3dns/ios.patch
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..27ab6ca 100644
--- a/DNS/Base.py
+++ b/DNS/Base.py
@@ -15,12 +15,13 @@ 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'].extend(['8.8.8.8', '8.8.4.4'])
+ return

def ParseResolvConfFromIterable(lines):
"parses a resolv.conf formatted stream and sets defaults for name servers"