Skip to content

Commit

Permalink
Meta packages have no subdirectories except doc
Browse files Browse the repository at this point in the history
  • Loading branch information
rkent committed Apr 19, 2024
1 parent dfdb458 commit 8289bce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rosdoc2/verbs/build/builders/index.rst.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Welcome to the documentation for {{ package.name }}
{% if interface_counts['srv'] > 0 %} Service Definitions <interfaces/service_definitions>{% endif %}
{% if interface_counts['action'] > 0 %} Action Definitions <interfaces/action_definitions>{% endif %}
{% if has_standard_docs %} Standard Documents <standards>{% endif %}
{% if not package.build_depends and package.exec_depends %}
{% if is_meta %}
Dependencies of this META package
---------------------------------
{% for dependency in package.exec_depends %}
Expand Down
19 changes: 18 additions & 1 deletion rosdoc2/verbs/build/builders/sphinx_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import json
import logging
import os
from pathlib import Path
import shutil
import subprocess

Expand Down Expand Up @@ -471,15 +472,31 @@ def build(self, *, doc_build_folder, output_staging_directory):

always_run_doxygen = build_context.always_run_doxygen
has_cpp = build_context.build_type in ['ament_cmake', 'cmake'] or always_run_doxygen
package = self.build_context.package

# Detect meta packages. They have no build_dependencies, do have exec_dependencies,
# and have no subdirectories except for possibly 'doc'.
is_meta = True
if package.build_depends or not package.exec_depends:
is_meta = False
else:
pp = Path(package_xml_directory)
subdirectories = [x for x in pp.iterdir() if x.is_dir()]
for subdirectory in subdirectories:
if subdirectory.name != 'doc':
is_meta = False
continue

self.template_variables.update({
'has_python': has_python,
'has_cpp': has_cpp,
'has_standard_docs': bool(standard_docs),
'has_documentation': bool(doc_directories),
'has_readme': 'readme' in standard_docs,
'interface_counts': interface_counts,
'package': self.build_context.package,
'package': package,
'base_url': base_url,
'is_meta': is_meta or package.is_metapackage(),
})

# Setup rosdoc2 Sphinx file which will include and extend the one in
Expand Down

0 comments on commit 8289bce

Please sign in to comment.