Skip to content

Commit

Permalink
Merge pull request #60 from ottojo/sphinx_conf_from_package_xml
Browse files Browse the repository at this point in the history
add more default configuration to sphinx conf.py
  • Loading branch information
tfoote authored Feb 27, 2024
2 parents 5c52cf3 + 3d7b2ea commit 97b3be2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ The Sphinx builder will attempt to do a few things to ensure it runs even withou

The final default is in place, even for packages with only C++, so that we can enable cross-referencing between packages using Sphinx and Breathe.

If an existing sphinx project is found, the `conf.py` sphinx configuration will be extended to enable rosdoc2-specific features according to the rosdoc2 configuration.
Additionally, the `project`, `author`, `release` and `version` options are populated from package.xml if they are not specified in `conf.py`.

#### Doxygen Builder

The Doxygen builder will attempt to run even with no additional configuration, following these steps:
Expand Down
11 changes: 10 additions & 1 deletion rosdoc2/verbs/build/builders/sphinx_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ def ensure_global(name, default):
ensure_global('rosdoc2_settings', {{}})
ensure_global('extensions', [])
ensure_global('project', "{package_name}")
ensure_global('author', "{package_authors}")
ensure_global('release', "{package.version}")
ensure_global('version', "{package_version_short}")
if rosdoc2_settings.get('enable_autodoc', True):
print('[rosdoc2] enabling autodoc', file=sys.stderr)
Expand Down Expand Up @@ -643,7 +647,12 @@ def generate_wrapping_rosdoc2_sphinx_project_into_directory(
'user_conf_py_filename': esc_backslash(
os.path.abspath(os.path.join(user_sourcedir, 'conf.py'))),
'breathe_projects': ',\n'.join(breathe_projects) + '\n ',
'intersphinx_mapping_extensions': ',\n '.join(intersphinx_mapping_extensions)
'intersphinx_mapping_extensions': ',\n '.join(intersphinx_mapping_extensions),
'package': package,
'package_authors': ', '.join(sorted(set(
[a.name for a in package.authors] + [m.name for m in package.maintainers]
))),
'package_version_short': '.'.join(package.version.split('.')[0:2]),
}

print(os.path.abspath(os.path.join(directory, 'conf.py')))
Expand Down

0 comments on commit 97b3be2

Please sign in to comment.