Skip to content

Commit

Permalink
add more default configuration to sphinx conf.py
Browse files Browse the repository at this point in the history
Add values extracted from package.xml to the wrapping sphinx config.py. This eliminates the need for packages with custom config.py to duplicate author, copyright and version information from package.xml.
  • Loading branch information
ottojo committed Feb 17, 2024
1 parent 5c52cf3 commit eca80c6
Showing 1 changed file with 10 additions and 1 deletion.
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(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 eca80c6

Please sign in to comment.