Skip to content

Commit

Permalink
run_sphinx_apidoc -> always_run_sphinx_apidoc
Browse files Browse the repository at this point in the history
This makes the intent of that option clearer.

Signed-off-by: Abrar Rahman Protyasha <[email protected]>
  • Loading branch information
Abrar Rahman Protyasha committed Aug 11, 2021
1 parent 146513e commit ef8840e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions rosdoc2/verbs/build/build_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ def add_python_source(self, *, python_source):
def add_always_run_doxygen(self, *, always_run_doxygen):
self.always_run_doxygen = always_run_doxygen

def add_run_sphinx_apidoc(self, *, run_sphinx_apidoc):
self.run_sphinx_apidoc = run_sphinx_apidoc
def add_always_run_sphinx_apidoc(self, *, always_run_sphinx_apidoc):
self.always_run_sphinx_apidoc = always_run_sphinx_apidoc
6 changes: 3 additions & 3 deletions rosdoc2/verbs/build/builders/sphinx_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
def generate_package_toc_entry(*, build_context) -> str:
build_type = build_context.build_type
always_run_doxygen = build_context.always_run_doxygen
run_sphinx_apidoc = build_context.run_sphinx_apidoc
always_run_sphinx_apidoc = build_context.always_run_sphinx_apidoc
toc_entry_py = f'\n {build_context.package.name} Python API <modules>'
toc_entry_cpp = '\n api/library_root\n Full C/C++ API <api/unabridged_api>\n File structure <api/unabridged_orphan>'
toc_entry = ''

if build_type == 'ament_python' or run_sphinx_apidoc:
if build_type == 'ament_python' or always_run_sphinx_apidoc:
toc_entry += toc_entry_py
if build_type in ['ament_cmake', 'cmake'] or always_run_doxygen:
toc_entry += toc_entry_cpp
Expand Down Expand Up @@ -391,7 +391,7 @@ def build(self, *, doc_build_folder, output_staging_directory):
# If the package has build type `ament_python`, or if the user configured
# to run `sphinx-apidoc`, then invoke `sphinx-apidoc` before building
if (self.build_context.build_type == 'ament_python' or
self.build_context.run_sphinx_apidoc):
self.build_context.always_run_sphinx_apidoc):
package_xml_directory = os.path.dirname(self.build_context.package.filename)
# If 'python_source' is specified, construct 'package_src_directory' from it
if self.build_context.python_source is not None:
Expand Down
2 changes: 1 addition & 1 deletion rosdoc2/verbs/build/inspect_package_for_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
## This setting, if true, attempts to run `sphinx-apidoc` regardless of build
## type. This is most useful if the user would like to generate Python API
## documentation for a package that is not of the `ament_python` build type.
run_sphinx_apidoc: false
always_run_sphinx_apidoc: false
builders:
## Each stanza represents a separate build step, performed by a specific 'builder'.
## The key of each stanza is the builder to use; this must be one of the
Expand Down
5 changes: 3 additions & 2 deletions rosdoc2/verbs/build/parse_rosdoc2_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ def parse_rosdoc2_yaml(yaml_string, build_context):
build_context.add_always_run_doxygen(
always_run_doxygen=settings_dict['always_run_doxygen'])

if 'run_sphinx_apidoc' in settings_dict:
build_context.add_run_sphinx_apidoc(run_sphinx_apidoc=settings_dict['run_sphinx_apidoc'])
if 'always_run_sphinx_apidoc' in settings_dict:
build_context.add_always_run_sphinx_apidoc(
always_run_sphinx_apidoc=settings_dict['always_run_sphinx_apidoc'])

if 'builders' not in config:
raise ValueError(
Expand Down

0 comments on commit ef8840e

Please sign in to comment.