From c5c7def1da89a5fc518dd96d2430fe1749041d29 Mon Sep 17 00:00:00 2001 From: Eric Bavier Date: Tue, 19 Nov 2024 23:34:15 -0600 Subject: gnu: python-sphobjinv: Update to 2.3.1.1. * gnu/packages/patches/python-sphobjinv-defer-ssl-import.patch: New patch. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/sphinx.scm (python-sphobjinv): Update to 2.3.1.1. [source]: Use patch. [arguments]: Replace check phase. [native-inputs]: New field. [propagated-inputs]: Remove python-fuzzywuzzy and python-levenshtein. Change-Id: Id60f45b222f286c8db55e9ce11378cf5ba82c603 --- .../python-sphobjinv-defer-ssl-import.patch | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 gnu/packages/patches/python-sphobjinv-defer-ssl-import.patch (limited to 'gnu/packages/patches/python-sphobjinv-defer-ssl-import.patch') diff --git a/gnu/packages/patches/python-sphobjinv-defer-ssl-import.patch b/gnu/packages/patches/python-sphobjinv-defer-ssl-import.patch new file mode 100644 index 0000000000..96c2c89703 --- /dev/null +++ b/gnu/packages/patches/python-sphobjinv-defer-ssl-import.patch @@ -0,0 +1,34 @@ +See suggestion in https://github.com/bskinn/sphobjinv/issues/275 + +This prevents the module from creating an ssl context upon import, when, +during a build especially, a certificate file may not be present. Otherwise +module import would fail. + +--- a/src/sphobjinv/inventory.py ++++ b/src/sphobjinv/inventory.py +@@ -30,7 +30,6 @@ Sphinx |objects.inv| files. + """ + + import re +-import ssl + import urllib.request as urlrq + from zlib import error as zlib_error + +@@ -218,8 +217,15 @@ class Inventory: + #: zlib compression line for v2 |objects.inv| header + header_zlib = "# The remainder of this file is compressed using zlib." + +- # Private class member for SSL context, since context creation is slow(?) +- _sslcontext = ssl.create_default_context(cafile=certifi.where()) ++ # Private class member for SSL context ++ _sslcontext_ = None ++ ++ @property ++ def _sslcontext(self): ++ import ssl ++ if not self._sslcontext_: ++ self._sslcontext_ = ssl.create_default_context(cafile=certifi.where()) ++ return self._sslcontext_ + + @property + def count(self): -- cgit v1.2.3