Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/mkdocstrings_handlers/python/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,9 @@ def normalize_extension_paths(self, extensions: Sequence) -> Sequence:
pth = str(ext)
options = None

if pth.endswith(".py") or ".py:" in pth or "/" in pth or "\\" in pth: # noqa: SIM102
# This is a sytem path. Normalize it.
if not os.path.isabs(pth):
# Make path absolute relative to config file path.
pth = os.path.normpath(os.path.join(base_path, pth))
if pth.endswith(".py") or ".py:" in pth or "/" in pth or "\\" in pth:
# This is a system path. Normalize it, make it absolute relative to config file path.
pth = os.path.abspath(os.path.join(base_path, pth))

if options is not None:
normalized.append({pth: options})
Expand Down
9 changes: 5 additions & 4 deletions tests/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ def test_expand_globs_without_changing_directory() -> None:
(True, {"extension.py:SomeExtension": {"option": "value"}}),
(True, {"path/to/extension.py": {"option": "value"}}),
(True, {"path/to/extension.py:SomeExtension": {"option": "value"}}),
(False, "/absolute/path/to/extension.py"),
(False, "/absolute/path/to/extension.py:SomeExtension"),
(False, {"/absolute/path/to/extension.py": {"option": "value"}}),
(False, {"/absolute/path/to/extension.py:SomeExtension": {"option": "value"}}),
# True because OS path normalization.
(True, "/absolute/path/to/extension.py"),
(True, "/absolute/path/to/extension.py:SomeExtension"),
(True, {"/absolute/path/to/extension.py": {"option": "value"}}),
(True, {"/absolute/path/to/extension.py:SomeExtension": {"option": "value"}}),
(False, "dot.notation.path.to.extension"),
(False, "dot.notation.path.to.pyextension"),
(False, {"dot.notation.path.to.extension": {"option": "value"}}),
Expand Down