1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
From: Christian Bayle <bayle@debian.org>
Date: Wed, 17 Sep 2025 02:02:22 +0200
Subject: set reproducible containder id
---
sphinx_needs/layout.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sphinx_needs/layout.py b/sphinx_needs/layout.py
index 1009cca..58b141a 100644
--- a/sphinx_needs/layout.py
+++ b/sphinx_needs/layout.py
@@ -7,6 +7,7 @@ Based on https://github.com/useblocks/sphinxcontrib-needs/issues/102
from __future__ import annotations
import os
+import hashlib
import re
import uuid
from contextlib import suppress
@@ -71,7 +72,7 @@ def build_need_repr(
new_need_node = lh.get_need_table()
node_container.append(new_need_node)
- container_id = "SNCB-" + str(uuid.uuid4())[:8]
+ container_id = "SNCB-" + hashlib.sha1(f"{docname}-{getattr(node, 'line', 0)}".encode()).hexdigest()[:8]
node_container.attributes["ids"] = [container_id]
node_container.attributes["classes"] = ["need_container"]
|