From 9c574df556c99b1f4c7179f71542624d9af5258a Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Fri, 29 Nov 2024 10:22:02 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A7=20Release=20needs=20data=20mut?= =?UTF-8?q?ation=20lock=20at=20end=20of=20process?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sphinx_needs/needs.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sphinx_needs/needs.py b/sphinx_needs/needs.py index e4917bda3..dced56caa 100644 --- a/sphinx_needs/needs.py +++ b/sphinx_needs/needs.py @@ -305,6 +305,7 @@ def setup(app: Sphinx) -> dict[str, Any]: app.connect("build-finished", build_needs_id_json) app.connect("build-finished", build_needumls_pumls) app.connect("build-finished", debug.process_timing) + app.connect("build-finished", release_data_lock, priority=9999) # Be sure Sphinx-Needs config gets erased before any events or external API calls get executed. # So never but this inside an event. @@ -734,3 +735,13 @@ def check_configuration(app: Sphinx, config: Config) -> None: class NeedsConfigException(SphinxError): pass + + +def release_data_lock(app: Sphinx, _exception: Exception) -> None: + """Release the lock on needs data mutations. + + This should ONLY be used at the very end of the sphinx processing. + The only reason is it is included is because esbonio does not properly re-start sphinx builds, + such that this would be re-set. + """ + SphinxNeedsData(app.env).needs_is_post_processed = False From c0190e01976988f4a00af327516afba9ef790ebb Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Fri, 29 Nov 2024 10:28:01 +0100 Subject: [PATCH 2/2] Update needs.py --- sphinx_needs/needs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sphinx_needs/needs.py b/sphinx_needs/needs.py index dced56caa..0306eb597 100644 --- a/sphinx_needs/needs.py +++ b/sphinx_needs/needs.py @@ -305,7 +305,7 @@ def setup(app: Sphinx) -> dict[str, Any]: app.connect("build-finished", build_needs_id_json) app.connect("build-finished", build_needumls_pumls) app.connect("build-finished", debug.process_timing) - app.connect("build-finished", release_data_lock, priority=9999) + app.connect("build-finished", release_data_locks, priority=9999) # Be sure Sphinx-Needs config gets erased before any events or external API calls get executed. # So never but this inside an event. @@ -737,7 +737,7 @@ class NeedsConfigException(SphinxError): pass -def release_data_lock(app: Sphinx, _exception: Exception) -> None: +def release_data_locks(app: Sphinx, _exception: Exception) -> None: """Release the lock on needs data mutations. This should ONLY be used at the very end of the sphinx processing. @@ -745,3 +745,4 @@ def release_data_lock(app: Sphinx, _exception: Exception) -> None: such that this would be re-set. """ SphinxNeedsData(app.env).needs_is_post_processed = False + app.env._needs_warnings_executed = False # type: ignore[attr-defined]