breathe icon indicating copy to clipboard operation
breathe copied to clipboard

Fix PosixPath issue with Sphinx 7.2

Open scottamain opened this issue 6 months ago • 7 comments

Just need to cast the path to a string.

Fixes https://github.com/breathe-doc/breathe/issues/944

scottamain avatar Dec 08 '23 18:12 scottamain

hi, I think you have the same fix but in other way in https://github.com/breathe-doc/breathe/pull/956

sergiomb2 avatar Jan 11 '24 23:01 sergiomb2

I spoke too soon , I use this fix instead of first change on commit of https://github.com/breathe-doc/breathe/pull/956

sergiomb2 avatar Jan 11 '24 23:01 sergiomb2

@jakobandersen sorry for the ping, but I believe you are a maintainer of Breathe -- do you think this PR would be mergeable? It's one of the main things preventing Sphinx 8.0 at the moment.

A

AA-Turner avatar Jan 19 '24 08:01 AA-Turner

Actually, the fix from #956 is more complete. Notably, the tests still fail with this one, so it's not even really "testable".

mgorny avatar Jan 27 '24 11:01 mgorny

Ah, fair enough -- though I don't believe #956 will work on older versions of Sphinx, it should use the Path constructor instead of assuming .parent exists.

A

AA-Turner avatar Jan 27 '24 14:01 AA-Turner

Are you asking me to open a fourth competing pull request? ;-)

mgorny avatar Jan 27 '24 15:01 mgorny

I be clear I use this one, more [1] found in #956

[1]

diff --git a/tests/test_renderer.py b/tests/test_renderer.py
index a858c65d..73a29e4e 100644
--- a/tests/test_renderer.py
+++ b/tests/test_renderer.py
@@ -35,7 +35,11 @@ def app(test_params, app_params, make_app, shared_result):
"""
args, kwargs = app_params
assert "srcdir" in kwargs
-    kwargs["srcdir"].makedirs(exist_ok=True)
+    try:
+        kwargs["srcdir"].mkdir(parents=True, exist_ok=True)
+    except AttributeError:
+        # old version of Sphinx
+        kwargs["srcdir"].makedirs(exist_ok=True)
(kwargs["srcdir"] / "conf.py").write_text("")
app_ = make_app(*args, **kwargs)
yield app_

sergiomb2 avatar Feb 19 '24 01:02 sergiomb2