Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path mapping is broken when relative and absolute paths are mixed on cli #91

Open
mb-emag opened this issue Feb 13, 2023 · 0 comments
Open

Comments

@mb-emag
Copy link
Contributor

mb-emag commented Feb 13, 2023

⚠️ 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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant