-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bundle dnspython in support/; resolving is always green
Fixes installation issue when older dnspython is present in system packages #341
- Loading branch information
Showing
101 changed files
with
14,678 additions
and
73 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
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 @@ | ||
#!/bin/bash -eux | ||
cd "$( dirname "${BASH_SOURCE[0]}" )/.." | ||
version=${1-188aa701a6826c607da0624e31a8c4618d0a8017} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
upstream_path=./dnspython-${version} | ||
if [[ ! -d "${upstream_path}" ]]; then | ||
curl -L -odnspython.zip "https://github.com/rthalley/dnspython/archive/${version}.zip" | ||
unzip dnspython.zip | ||
rm dnspython.zip | ||
fi | ||
rm -rf eventlet/support/dns | ||
# patch --directory=eventlet/support -p1 --normal --forward -r/dev/null <./dns.patch | ||
mv ${upstream_path}/dns eventlet/support/ | ||
rm -rf ${upstream_path} |
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 |
---|---|---|
@@ -1,38 +1,30 @@ | ||
import os | ||
import sys | ||
import warnings | ||
|
||
__import__('eventlet.green._socket_nodns') | ||
__socket = sys.modules['eventlet.green._socket_nodns'] | ||
|
||
__all__ = __socket.__all__ | ||
__patched__ = __socket.__patched__ + ['gethostbyname', 'getaddrinfo', 'create_connection', ] | ||
__patched__ = __socket.__patched__ + ['gethostbyname', 'getaddrinfo', 'create_connection'] | ||
This comment has been minimized.
Sorry, something went wrong.
tipabu
Contributor
|
||
|
||
from eventlet.patcher import slurp_properties | ||
slurp_properties(__socket, globals(), srckeys=dir(__socket)) | ||
|
||
|
||
greendns = None | ||
if os.environ.get("EVENTLET_NO_GREENDNS", '').lower() != "yes": | ||
try: | ||
from eventlet.support import greendns | ||
except ImportError as ex: | ||
try: | ||
import dns | ||
except ImportError: | ||
# greendns import failed because we don't have dnspython - all is well, | ||
# that's why we have the conditional import | ||
pass | ||
else: | ||
# If, however, dnspython is importable yet greendns can't be imported | ||
# this suggests there's another issue (like an import cycle) | ||
raise | ||
if os.environ.get("EVENTLET_NO_GREENDNS", '').lower() == "yes": | ||
warnings.warn( | ||
'EVENTLET_NO_GREENDNS is noop, dnspython is bundled and DNS resolution is always green', | ||
DeprecationWarning, | ||
stacklevel=2, | ||
) | ||
|
||
if greendns: | ||
gethostbyname = greendns.gethostbyname | ||
getaddrinfo = greendns.getaddrinfo | ||
gethostbyname_ex = greendns.gethostbyname_ex | ||
getnameinfo = greendns.getnameinfo | ||
__patched__ = __patched__ + ['gethostbyname_ex', 'getnameinfo'] | ||
from eventlet.support import greendns | ||
gethostbyname = greendns.gethostbyname | ||
getaddrinfo = greendns.getaddrinfo | ||
gethostbyname_ex = greendns.gethostbyname_ex | ||
getnameinfo = greendns.getnameinfo | ||
__patched__ = __patched__ + ['gethostbyname_ex', 'getnameinfo'] | ||
|
||
|
||
def create_connection(address, | ||
|
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,54 @@ | ||
# Copyright (C) 2003-2007, 2009, 2011 Nominum, Inc. | ||
# | ||
# Permission to use, copy, modify, and distribute this software and its | ||
# documentation for any purpose with or without fee is hereby granted, | ||
# provided that the above copyright notice and this permission notice | ||
# appear in all copies. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES | ||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR | ||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | ||
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
|
||
"""dnspython DNS toolkit""" | ||
|
||
__all__ = [ | ||
'dnssec', | ||
'e164', | ||
'edns', | ||
'entropy', | ||
'exception', | ||
'flags', | ||
'hash', | ||
'inet', | ||
'ipv4', | ||
'ipv6', | ||
'message', | ||
'name', | ||
'namedict', | ||
'node', | ||
'opcode', | ||
'query', | ||
'rcode', | ||
'rdata', | ||
'rdataclass', | ||
'rdataset', | ||
'rdatatype', | ||
'renderer', | ||
'resolver', | ||
'reversename', | ||
'rrset', | ||
'set', | ||
'tokenizer', | ||
'tsig', | ||
'tsigkeyring', | ||
'ttl', | ||
'rdtypes', | ||
'update', | ||
'version', | ||
'wiredata', | ||
'zone', | ||
] |
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,47 @@ | ||
import sys | ||
import decimal | ||
from decimal import Context | ||
|
||
if sys.version_info > (3,): | ||
long = int | ||
xrange = range | ||
else: | ||
long = long # pylint: disable=long-builtin | ||
xrange = xrange # pylint: disable=xrange-builtin | ||
|
||
# unicode / binary types | ||
if sys.version_info > (3,): | ||
text_type = str | ||
binary_type = bytes | ||
string_types = (str,) | ||
unichr = chr | ||
def maybe_decode(x): | ||
return x.decode() | ||
def maybe_encode(x): | ||
return x.encode() | ||
else: | ||
text_type = unicode # pylint: disable=unicode-builtin, undefined-variable | ||
binary_type = str | ||
string_types = ( | ||
basestring, # pylint: disable=basestring-builtin, undefined-variable | ||
) | ||
unichr = unichr # pylint: disable=unichr-builtin | ||
def maybe_decode(x): | ||
return x | ||
def maybe_encode(x): | ||
return x | ||
|
||
|
||
def round_py2_compat(what): | ||
""" | ||
Python 2 and Python 3 use different rounding strategies in round(). This | ||
function ensures that results are python2/3 compatible and backward | ||
compatible with previous py2 releases | ||
:param what: float | ||
:return: rounded long | ||
""" | ||
d = Context( | ||
prec=len(str(long(what))), # round to integer with max precision | ||
rounding=decimal.ROUND_HALF_UP | ||
).create_decimal(str(what)) # str(): python 2.6 compat | ||
return long(d) |
Oops, something went wrong.
I'm a little wary of taking tip-of-master rather than a tagged release, but maybe that's overly-cautious of me.