doxysphinx
doxysphinx copied to clipboard
Path mapping is broken when relative and absolute paths are mixed on cli
⚠️ Problem E.g. when using a doxysphinx call like this:
doxysphinx /workspaces/doxysphinx ../build/doxygen_docs doxygen/
The following error will occur:
ValueError: '/workspaces/build/doxygen_docs/doxygen' is not in the subpath of '/workspaces/doxysphinx' OR one path is relative and the other is absolute.
🚸 Workaround Until this is fixed we recommend to always use absolute paths for your input paths (last argument above).
🔍 Analysis digging deeper into that issue it becomes clear that the only thing of relevance is the "relativity" of the input path:
using this pytest:
@pytest.mark.parametrize(
"source, output, to_map",
[
(Path("."), Path("../build/doxygen_docs"), Path("doxygen/")),
(Path("/workspaces/doxysphinx"), Path("../build/doxygen_docs"), Path("doxygen/")),
(Path("/workspaces/doxysphinx"), Path("/workspaces/build/doxygen_docs"), Path("doxygen/")),
(Path("/workspaces/doxysphinx"), Path("/workspaces/build/doxygen_docs"), Path("/workspaces/doxysphinx/doxygen/")),
(Path("."), Path("/workspaces/build/doxygen_docs"), Path("/workspaces/doxysphinx/doxygen/")),
(Path("/workspaces/doxysphinx"), Path("../build/doxygen_docs"), Path("/workspaces/doxysphinx/doxygen/")),
(Path("."), Path("../build/doxygen_docs"), Path("/workspaces/doxysphinx/doxygen/"))
],
)
def test_path_regression(source: Path, output: Path, to_map: Path):
current = Path.cwd()
os.chdir(source)
mapper = SphinxHtmlBuilderDirectoryMapper(source, output)
mapper.map(to_map)
os.chdir(current)
we'll get the following results:
