Skip to content

Commit

Permalink
Add the module path to sys.path (not its parent)
Browse files Browse the repository at this point in the history
Without a trailing slash, `os.path.dirname` returns a path to the
the parent directory of the path provided, which defeats the point
of adding the module path to sys.path.

Signed-off-by: Abrar Rahman Protyasha <[email protected]>
  • Loading branch information
aprotyas committed Apr 3, 2022
1 parent fb0eab5 commit aa94104
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rosdoc2/verbs/build/builders/sphinx_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def ensure_global(name, default):
# Note: `autodoc` only mocks up those modules that it actually cannot locate in PATH
autodoc_mock_imports = {exec_depends}
# Add the package directory to PATH, so that `sphinx-autodoc` can import it
sys.path.insert(0, os.path.dirname('{package_src_directory}'))
sys.path.insert(0, os.path.dirname('{package_src_directory}/'))
if rosdoc2_settings.get('enable_intersphinx', True):
print('[rosdoc2] enabling intersphinx', file=sys.stderr)
Expand Down

0 comments on commit aa94104

Please sign in to comment.