1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

gnu: Add python-jinja2-fragments.

* gnu/packages/patches/python-jinja2-fragments-modify-conftest-py.patch:
  New file
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/python-xyz.scm (python-jinja2-fragments): New variable.

Merges: https://codeberg.org/guix/guix/pulls/6321
Change-Id: I03a88537cea8e769a33ddfe50b418b5b518e5854
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
Tanguy Le Carrour
2026-02-11 13:11:45 +01:00
committed by Sharlatan Hellseher
parent 619414f7b6
commit 85673d5f0b
3 changed files with 94 additions and 2 deletions

View File

@@ -35,7 +35,7 @@
# Copyright © 2020 Ryan Prior <rprior@protonmail.com>
# Copyright © 2020 Jan Wielkiewicz <tona_kosmicznego_smiecia@interia.pl>
# Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re>
# Copyright © 2020, 2023, 2025 Tanguy Le Carrour <tanguy@bioneland.org>
# Copyright © 2020, 2023, 2025, 2026 Tanguy Le Carrour <tanguy@bioneland.org>
# Copyright © 2020 Martin Becze <mjbecze@riseup.net>
# Copyright © 2020 Malte Frank Gerdes <mate.f.gerdes@gmail.com>
# Copyright © 2020, 2023 Vinicius Monego <monego@posteo.net>
@@ -2098,6 +2098,7 @@ dist_patch_DATA = \
%D%/packages/patches/python-docrepr-fix-tests.patch \
%D%/packages/patches/python-gpg-setup-72.patch \
%D%/packages/patches/python-hdmedians-replace-nose.patch \
%D%/packages/patches/python-jinja2-fragments-modify-conftest-py.patch \
%D%/packages/patches/python-louvain-fix-test.patch \
%D%/packages/patches/python-mohawk-pytest.patch \
%D%/packages/patches/python-msal-requests.patch \

View File

@@ -0,0 +1,53 @@
From c3c7d6fd6cbc275fffd0d1da07aa4fc1ad8295e0 Mon Sep 17 00:00:00 2001
From: Tanguy Le Carrour <tanguy@bioneland.org>
Date: Wed, 18 Feb 2026 08:47:27 +0100
Subject: [PATCH] Remove mentions to litestar and sanic from test
configuration.
---
tests/conftest.py | 19 -------------------
1 file changed, 19 deletions(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index 981b116..4c02ef3 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -4,13 +4,9 @@ import pathlib
import fastapi
import flask
-import litestar
import pytest
import quart
-import sanic
-import sanic_ext
from jinja2 import Environment, FileSystemLoader, select_autoescape
-from litestar.testing import TestClient as LitestarTestClient
from starlette.responses import HTMLResponse
from starlette.testclient import TestClient
@@ -19,21 +15,6 @@ from jinja2_fragments.flask import render_block as flask_render_block
from jinja2_fragments.flask import render_blocks as flask_render_blocks
from jinja2_fragments.quart import render_block as quart_render_block
from jinja2_fragments.quart import render_blocks as quart_render_blocks
-from jinja2_fragments.sanic import render as sanic_render
-
-# fmt: off
-# Needed for type hints because we are using `from __future__ import annotations`
-# to support Python <3.10. See
-# https://stackoverflow.com/questions/66734640/any-downsides-to-using-from-future-import-annotations-everywhere
-# for shortcomings of using the annotations import,
-try:
- # litestar>=2.13.0
- from litestar.plugins.htmx import HTMXRequest # noqa isort: skip
-except ImportError:
- # litestar<2.13.0
- from litestar.contrib.htmx.request import HTMXRequest # noqa isort: skip
-from litestar.response import Template # noqa isort: skip
-# fmt: on
NAME = "Guido"
LUCKY_NUMBER = "42"
--
2.52.0

View File

@@ -66,7 +66,7 @@
;;; Copyright © 2019 Jacob MacDonald <jaccarmac@gmail.com>
;;; Copyright © 2019-2021, 2023, 2024, 2026 Giacomo Leidi <therewasa@fishinthecalculator.me>
;;; Copyright © 2019 Wiktor Żelazny <wzelazny@vurv.cz>
;;; Copyright © 2019, 2020, 2021, 2022 Tanguy Le Carrour <tanguy@bioneland.org>
;;; Copyright © 2019, 2020, 2021, 2022, 2026 Tanguy Le Carrour <tanguy@bioneland.org>
;;; Copyright © 2019, 2021-2023 Mădălin Ionel Patrașcu <madalinionel.patrascu@mdc-berlin.de>
;;; Copyright © 2020 Riku Viitanen <riku.viitanen@protonmail.com>
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
@@ -8844,6 +8844,44 @@ for Python.")
written in pure Python.")
(license license:bsd-3)))
(define-public python-jinja2-fragments
(package
(name "python-jinja2-fragments")
(version "1.11.0")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/sponsfreixes/jinja2-fragments")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32 "14qr0ppllq296c1y2i5ly8l4y97q8msin5khlpli3akgrzsnvmkl"))
(patches
;; Remove test setup code related to `litestar` and `sanic`
(search-patches "python-jinja2-fragments-modify-conftest-py.patch"))))
(build-system pyproject-build-system)
(arguments
(list
#:test-flags
#~(list "--ignore=tests/test_litestar.py"
"--ignore=tests/test_sanic.py")))
(native-inputs
(list python-fastapi
python-flask
python-pytest
python-pytest-asyncio
python-quart
python-setuptools))
(propagated-inputs
(list python-jinja2))
(home-page "https://github.com/sponsfreixes/jinja2-fragments")
(synopsis "Jinja2 extension for template fragments")
(description
"Render Jinja2 template block as HTML page fragments on Python web
frameworks.")
(license license:expat)))
(define-public python-pypugjs
(package
(name "python-pypugjs")