diff --git a/Makefile b/Makefile index c1e4fc722e2..f1670ba7310 100644 --- a/Makefile +++ b/Makefile @@ -81,10 +81,7 @@ multiversion: Makefile @echo Step 3: Deleting temporary commits ./make_help_scripts/delete_tmp_commits.py @echo Step 4: Create correct index + legacy master version - @echo "" > "$(BUILDDIR)"/html/index.html -# legacy, renamed Rolling version from "master" to "rolling" - @cp -r "$(BUILDDIR)"/html/rolling/ "$(BUILDDIR)"/html/master - @echo "" > "$(BUILDDIR)"/html/master/index.html + ./make_help_scripts/fix_index.py --build-dir $(BUILDDIR) multiversion-with-errors: Makefile @echo Building multi version documentation without API @@ -95,10 +92,7 @@ multiversion-with-errors: Makefile @echo Step 3: Deleting temporary commits ./make_help_scripts/delete_tmp_commits.py @echo Step 4: Create correct index + legacy master version - @echo "" > "$(BUILDDIR)"/html/index.html -# legacy, renamed Rolling version from "master" to "rolling" - @cp -r "$(BUILDDIR)"/html/rolling/ "$(BUILDDIR)"/html/master - @echo "" > "$(BUILDDIR)"/html/master/index.html + ./make_help_scripts/fix_index.py --build-dir $(BUILDDIR) multiversion-with-api: Makefile @echo Building multi version documentation with API @@ -113,10 +107,7 @@ multiversion-with-api: Makefile @echo Step 5: Building multiversion API ./make_help_scripts/create_api_multi_version.py @echo Step 6: Create correct index + legacy master version - @echo "" > "$(BUILDDIR)"/html/index.html -# legacy, renamed Rolling version from "master" to "rolling" - @cp -r "$(BUILDDIR)"/html/rolling/ "$(BUILDDIR)"/html/master - @echo "" > "$(BUILDDIR)"/html/master/index.html + ./make_help_scripts/fix_index.py --build-dir $(BUILDDIR) .PHONY: help Makefile html-with-errors html-with-api multiversion multiversion-with-api multiversion-with-errors html-all-subrepos html-all-subrepos-with-api html-all-subrepos-with-errors linkcheck-all-subrepos-with-api diff --git a/conf.py b/conf.py index f1968770d80..6db9c4befce 100644 --- a/conf.py +++ b/conf.py @@ -29,11 +29,11 @@ copyright = "{}, {}".format(time.strftime("%Y"), author) # Adjust those to change ros distribution -# you might also need to white list branch +# you might also need to white list branch (see smv_branch_whitelist) ros_distro = "rolling" distro_title = "Rolling" distro_title_full = "Rolling Ridley" -repos_file_branch = "rolling" # for single version only +repos_file_branch = "master" # sets macro REPOS_FILE_BRANCH (will be overridden with multiversion) # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -341,7 +341,7 @@ def smv_rewrite_configs(app, config): # this map is used to match branches of control.ros.org to REPOS_FILE_BRANCH macro subrepo_branch = { base_branch: "master", - "jazzy": "jazzy", + "jazzy": "master", "iron": "iron", "humble": "humble", "foxy": "foxy", diff --git a/make_help_scripts/fix_index.py b/make_help_scripts/fix_index.py new file mode 100755 index 00000000000..36b16b339f7 --- /dev/null +++ b/make_help_scripts/fix_index.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# Copyright (c) 2023 ros2_control maintainers +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse +import os +import shutil +import deploy_defines + +def fix_index(base_branch, builddir): + + # Create the index.html file in the html directory + with open(os.path.join(builddir, 'html', 'index.html'), 'w') as f: + f.write(f'') + + # Copy the contents of the base_branch directory to the master directory + shutil.copytree(os.path.join(builddir, 'html', base_branch), os.path.join(builddir, 'html', 'master'), dirs_exist_ok=True) + + # Patch the index.html file in the master directory + with open(os.path.join(builddir, 'html', 'master', 'index.html'), 'w') as f: + f.write(f'') + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description='Fix index.') + parser.add_argument('--build-dir', required=True, help='Build directory.') + + args = parser.parse_args() + fix_index(deploy_defines.base_branch, args.build_dir)