Skip to content

Commit

Permalink
Solve the issue of the APIs not being generated (#1010)
Browse files Browse the repository at this point in the history
* Refs #21777: Change the default branch if not set for python

Signed-off-by: Juanjo Garcia <[email protected]>

* Refs #21777: Change the default branch for FastDDs, and mimic 2.10.x format

Signed-off-by: Juanjo Garcia <[email protected]>

* Refs #21777: Default Pyhton branch set to 1.1.x

Signed-off-by: Juanjo Garcia <[email protected]>

* Refs #21777: Corrected typo

Signed-off-by: Juanjo Garcia <[email protected]>

* Refs #21777: include checks like in 2.10.x, as described in PR #799

Signed-off-by: Juanjo Garcia <[email protected]>

---------

Signed-off-by: Juanjo Garcia <[email protected]>
  • Loading branch information
juanjo4936 authored Jan 16, 2025
1 parent b601265 commit b547635
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,22 +216,13 @@ def configure_doxyfile(
fastdds_branch = os.environ.get('FASTDDS_BRANCH', None)

# First try to checkout to ${FASTDDS_BRANCH}
# Else try with current documentation branch
# Else checkout to master
# Else checkout to 2.6.x
if (fastdds_branch and
fastdds.refs.__contains__('origin/{}'.format(fastdds_branch))):
fastdds_branch = 'origin/{}'.format(fastdds_branch)
elif (docs_branch and
fastdds.refs.__contains__('origin/{}'.format(docs_branch))):
fastdds_branch = 'origin/{}'.format(docs_branch)
else:
print(
'Fast DDS does not have either "{}" or "{}" branches'.format(
fastdds_branch,
docs_branch
)
)
fastdds_branch = 'origin/master'
fastdds_branch = 'origin/2.6.x'
print(f'Fast DDS branch is not set by env var. Using "{fastdds_branch}"')

# Actual checkout
print('Checking out Fast DDS branch "{}"'.format(fastdds_branch))
Expand All @@ -248,20 +239,14 @@ def configure_doxyfile(
fastdds_python_branch = os.environ.get('FASTDDS_PYTHON_BRANCH', None)

# First try to checkout to ${FASTDDS_PYTHON_BRANCH}
# Else try with current documentation branch
# Else checkout to master
# Else checkout to 1.1.x
if (fastdds_python_branch and
fastdds_python.refs.__contains__(
'origin/{}'.format(fastdds_python_branch))):
fastdds_python_branch = 'origin/{}'.format(fastdds_python_branch)
elif (docs_branch and
fastdds_python.refs.__contains__('origin/{}'.format(docs_branch))):
fastdds_python_branch = 'origin/{}'.format(docs_branch)
else:
print(
'Fast DDS Python does not have either "{}" or "{}" branches'
.format(fastdds_python_branch, docs_branch))
fastdds_python_branch = 'origin/main'
fastdds_python_branch = 'origin/1.1.x'
print(f'Fast DDS Python branch is not set by env var. Using "{fastdds_python_branch}"')

# Actual checkout
print('Checking out Fast DDS Python branch "{}"'.format(
Expand All @@ -281,10 +266,13 @@ def configure_doxyfile(
project_source_dir
)
# Generate doxygen documentation
subprocess.call('doxygen {}'.format(doxyfile_out), shell=True)
doxygen_ret = subprocess.call('doxygen {}'.format(doxyfile_out), shell=True)
if doxygen_ret != 0:
print('Doxygen failed with return code {}'.format(doxygen_ret))
sys.exit(doxygen_ret)

# Generate SWIG code.
subprocess.call('swig -python -doxygen -I{}/include \
swig_ret = subprocess.call('swig -python -doxygen -I{}/include \
-outdir {}/fastdds_python/src/swig -c++ -interface \
_fastdds_python -o \
{}/fastdds_python/src/swig/fastddsPYTHON_wrap.cxx \
Expand All @@ -294,6 +282,10 @@ def configure_doxyfile(
fastdds_python_repo_name,
fastdds_python_repo_name
), shell=True)
if swig_ret != 0:
print('SWIG failed with return code {}'.format(swig_ret))
sys.exit(swig_ret)

fastdds_python_imported_location = '{}/fastdds_python/src/swig'.format(
fastdds_python_repo_name)
autodoc_mock_imports = ["_fastdds_python"]
Expand Down

0 comments on commit b547635

Please sign in to comment.