From aa94104f747b3b5075326d065bbc4bbfd1127df7 Mon Sep 17 00:00:00 2001 From: Abrar Rahman Protyasha Date: Sun, 3 Apr 2022 02:59:30 -0400 Subject: [PATCH] Add the module path to sys.path (not its parent) 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 --- rosdoc2/verbs/build/builders/sphinx_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rosdoc2/verbs/build/builders/sphinx_builder.py b/rosdoc2/verbs/build/builders/sphinx_builder.py index bdb590b..c5ea381 100644 --- a/rosdoc2/verbs/build/builders/sphinx_builder.py +++ b/rosdoc2/verbs/build/builders/sphinx_builder.py @@ -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)