From b960746197c3edd09837353adcd7d6a1e921287e Mon Sep 17 00:00:00 2001 From: Nicolas Graves Date: Wed, 23 Jul 2025 18:34:04 +0200 Subject: [PATCH] gnu: python-eventlet: Set EVENTLET_NO_GREENDNS=yes by default. This error propagates and pollutes user experience in Guix. Until someone tackles how to actually fix it, if it's even fixable in Guix, change the hardcoded default. * gnu/packages/python-web.scm (python-eventlet): [arguments]<#:phases>: Set EVENTLET_NO_GREENDNS=yes by default in phase 'avoid-OSError. [description]: Update the description to warn about the changed default. (python-httpretty)[arguments]: Remove uneeded field. * gnu/packages/python-xyz.scm (python-pydevd)[arguments]<#:phases>: Unset the variable in phase 'pre-check. * gnu/packages/tor.scm (onionshare, onionshare-cli)[arguments] <#:phases>: Unset the variable in phase 'pre-check. Change-Id: Ic3897a9e0006338c3bc8b4bcddab0948e76a5d87 Signed-off-by: Sharlatan Hellseher --- gnu/packages/python-web.scm | 31 +++++++++++++++++-------------- gnu/packages/python-xyz.scm | 3 --- gnu/packages/tor.scm | 9 +-------- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm index 7558a108faba0502f28adbe0415fe6814487f0fc..5f2beb729e9cce911071bfa60592f5c0f78fb8ad 100644 --- a/gnu/packages/python-web.scm +++ b/gnu/packages/python-web.scm @@ -623,13 +623,17 @@ Dropbox API v2.") " and not test_patcher_existing_locks" " and not test_dns_methods_are_green")) #:phases - '(modify-phases %standard-phases - (add-after 'unpack 'avoid-OSError - (lambda _ - ;; If eventlet tries to load greendns, an OSError is thrown when - ;; getprotobyname is called. Thankfully there is an environment - ;; variable to disable the greendns import, so use it: - (setenv "EVENTLET_NO_GREENDNS" "yes")))))) + #~(modify-phases %standard-phases + (add-after 'unpack 'avoid-OSError + (lambda _ + ;; If eventlet tries to load greendns, an OSError is thrown when + ;; getprotobyname is called. Thankfully there is an environment + ;; variable to disable the greendns import, so use it. Note that + ;; this error is propagated to child packages too, so enforce the + ;; changed default. + (substitute* "eventlet/green/socket.py" + (("os\\.environ\\.get\\(\"EVENTLET_NO_GREENDNS\", ''\\)") + "os.environ.get(\"EVENTLET_NO_GREENDNS\", \"yes\")"))))))) (native-inputs (list python-hatch-vcs python-hatchling @@ -648,7 +652,11 @@ It uses @code{epoll} or @code{libevent} for highly scalable non-blocking I/O. Coroutines ensure that the developer uses a blocking style of programming that is similar to threading, but provide the benefits of non-blocking I/O. The event dispatch is implicit, which means you can easily use @code{Eventlet} -from the Python interpreter, or as a small part of a larger application.") +from the Python interpreter, or as a small part of a larger application. + +Note: In Guix, this package assumes the environment variable +@code{EVENTLET_NO_GREENDNS} defaults to @code{yes}. To try to use it, set it +to anything else.") (license license:expat))) (define-public python-globus-sdk @@ -781,12 +789,7 @@ of a fake DNS resolver.") "test_request_parse_querystring" "test_request_string_representation" "test_request_stubs_internals") - " and not ")) - #:phases - #~(modify-phases %standard-phases - (add-before 'check 'pre-check - (lambda _ - (setenv"EVENTLET_NO_GREENDNS" "yes")))))) + " and not ")))) (native-inputs (list nss-certs-for-test python-freezegun diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 1df15aaebd632c975ce129a223f04e4512566acd..498d7e41cb40452a8ca09e7d3bc85d668eb7e063 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -18762,9 +18762,6 @@ libmagic."))) (add-before 'check 'pre-check (lambda* (#:key tests? #:allow-other-keys) (when tests? - ;; Without this we get this error: type object 'GreenSocket' - ;; has no attribute 'sendmsg'. - (setenv "EVENTLET_NO_GREENDNS" "YES") (setenv "PYDEVD_USE_CYTHON" "YES")))) (add-after 'install 'install-attach-binary (lambda _ diff --git a/gnu/packages/tor.scm b/gnu/packages/tor.scm index f3044dc9e6059f30727ea5ca31037525c12daed6..2c4ca1b814cdb840d488d10b043444507716f17e 100644 --- a/gnu/packages/tor.scm +++ b/gnu/packages/tor.scm @@ -338,12 +338,7 @@ networks.") (add-before 'check 'pre-check (lambda* (#:key tests? #:allow-other-keys) (when tests? - (setenv "HOME" "/tmp") - ;; Greendns is not needed for testing, and if eventlet tries - ;; to load it, an OSError is thrown when getprotobyname is - ;; called. Thankfully there is an environment variable to - ;; disable the greendns import, so use it: - (setenv "EVENTLET_NO_GREENDNS" "yes"))))))) + (setenv "HOME" "/tmp"))))))) (home-page "https://onionshare.org/") (synopsis "Securely and anonymously share files") (description "OnionShare lets you securely and anonymously share files, @@ -385,8 +380,6 @@ OnionShare.") (substitute* "tests/conftest.py" (("\"cli\",") "\"/nonexistent\"")) - ;; Avoid `getprotobyname` issues: - (setenv "EVENTLET_NO_GREENDNS" "yes") ;; Make Qt render "offscreen": (setenv "QT_QPA_PLATFORM" "offscreen") (setenv "HOME" "/tmp")