From be497847c9adc1ca52659bd64ee2a398cec6bc9e Mon Sep 17 00:00:00 2001 From: wrvsrx Date: Tue, 24 Feb 2026 15:35:18 +0800 Subject: [PATCH] python3Packages.sphinxcontrib-newsfeed: make it work with sphinx 9.1 This commit fixes the build of khal. --- .../sphinxcontrib-newsfeed/default.nix | 5 +++++ .../fix-for-sphinx-9.1.patch | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 pkgs/development/python-modules/sphinxcontrib-newsfeed/fix-for-sphinx-9.1.patch diff --git a/pkgs/development/python-modules/sphinxcontrib-newsfeed/default.nix b/pkgs/development/python-modules/sphinxcontrib-newsfeed/default.nix index 29282610790f..1badf4ca4d48 100644 --- a/pkgs/development/python-modules/sphinxcontrib-newsfeed/default.nix +++ b/pkgs/development/python-modules/sphinxcontrib-newsfeed/default.nix @@ -16,6 +16,11 @@ buildPythonPackage rec { sha256 = "1d7gam3mn8v4in4p16yn3v10vps7nnaz6ilw99j4klij39dqd37p"; }; + patches = [ + # reference: https://github.com/prometheusresearch/sphinxcontrib-newsfeed/pull/7 + ./fix-for-sphinx-9.1.patch + ]; + nativeBuildInputs = [ setuptools ]; propagatedBuildInputs = [ sphinx ]; diff --git a/pkgs/development/python-modules/sphinxcontrib-newsfeed/fix-for-sphinx-9.1.patch b/pkgs/development/python-modules/sphinxcontrib-newsfeed/fix-for-sphinx-9.1.patch new file mode 100644 index 000000000000..ce6e841a708e --- /dev/null +++ b/pkgs/development/python-modules/sphinxcontrib-newsfeed/fix-for-sphinx-9.1.patch @@ -0,0 +1,16 @@ +diff --git a/sphinxcontrib/newsfeed.py b/sphinxcontrib/newsfeed.py +index 2e155cd..64b30d9 100644 +--- a/sphinxcontrib/newsfeed.py ++++ b/sphinxcontrib/newsfeed.py +@@ -265,8 +265,9 @@ def process_feed(app, doctree, fromdocname): + replacement.append(section_node) + env.resolve_references(rss_item_description, docname, app.builder) + if app.builder.format == 'html': +- rss_item_description = app.builder.render_partial( +- rss_item_description)['body'] ++ rendered = app.builder.render_partial(rss_item_description) ++ # Sphinx 9.1+ changed 'body' to 'fragment' ++ rss_item_description = rendered.get('fragment', rendered.get('body', '')) + rss_item_date = meta['date'] + rss_item = RSSItem(rss_item_title, rss_item_link, + rss_item_description, rss_item_date)