From 7ef775a109da644df77bb885e7cd02f0e24e705c Mon Sep 17 00:00:00 2001 From: Carlo Strub Date: Wed, 29 Mar 2017 21:07:54 +0000 Subject: [PATCH] Fix attribute error PR: 217867 Submitted by: Alexander Nusov --- net/py-eventlet/Makefile | 1 + .../files/patch-eventlet_support_greendns.py | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 net/py-eventlet/files/patch-eventlet_support_greendns.py diff --git a/net/py-eventlet/Makefile b/net/py-eventlet/Makefile index 9a3073f69d63..cb744678b1ba 100644 --- a/net/py-eventlet/Makefile +++ b/net/py-eventlet/Makefile @@ -3,6 +3,7 @@ PORTNAME= eventlet PORTVERSION= 0.20.1 +PORTREVISION= 1 CATEGORIES= net python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} diff --git a/net/py-eventlet/files/patch-eventlet_support_greendns.py b/net/py-eventlet/files/patch-eventlet_support_greendns.py new file mode 100644 index 000000000000..695b2e30077a --- /dev/null +++ b/net/py-eventlet/files/patch-eventlet_support_greendns.py @@ -0,0 +1,27 @@ +--- eventlet/support/greendns.py.orig 2017-03-29 21:00:19 UTC ++++ eventlet/support/greendns.py +@@ -79,8 +79,14 @@ DNS_QUERY_TIMEOUT = 10.0 + HOSTS_TTL = 10.0 + + EAI_EAGAIN_ERROR = socket.gaierror(socket.EAI_AGAIN, 'Lookup timed out') +-EAI_NODATA_ERROR = socket.gaierror(socket.EAI_NODATA, 'No address associated with hostname') + EAI_NONAME_ERROR = socket.gaierror(socket.EAI_NONAME, 'Name or service not known') ++# EAI_NODATA was removed from RFC3493, it's now replaced with EAI_NONAME ++# socket.EAI_NODATA is not defined on FreeBSD, probably on some other platforms too. ++# https://lists.freebsd.org/pipermail/freebsd-ports/2003-October/005757.html ++EAI_NODATA_ERROR = EAI_NONAME_ERROR ++if (os.environ.get('EVENTLET_DEPRECATED_EAI_NODATA', '').lower() in ('1', 'y', 'yes') ++ and hasattr(socket, 'EAI_NODATA')): ++ EAI_NODATA_ERROR = socket.gaierror(socket.EAI_NODATA, 'No address associated with hostname') + + + def is_ipv4_addr(host): +@@ -448,7 +454,7 @@ def _getaddrinfo_lookup(host, family, fl + try: + answer = resolve(host, qfamily, False) + except socket.gaierror as e: +- if e.errno not in (socket.EAI_AGAIN, socket.EAI_NODATA): ++ if e.errno not in (socket.EAI_AGAIN, EAI_NONAME_ERROR.errno, EAI_NODATA_ERROR.errno): + raise + err = e + else: