From 5fedeb560e9afe1ba475ee0740880b2ea45d1b9b Mon Sep 17 00:00:00 2001 From: Nicola Coretti Date: Fri, 15 Nov 2024 15:15:45 +0100 Subject: [PATCH 1/5] Add CLI option to enable debug output --- exasol/toolbox/sphinx/multiversion/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/exasol/toolbox/sphinx/multiversion/main.py b/exasol/toolbox/sphinx/multiversion/main.py index 31e48ba41..9abeb27d9 100644 --- a/exasol/toolbox/sphinx/multiversion/main.py +++ b/exasol/toolbox/sphinx/multiversion/main.py @@ -228,6 +228,11 @@ def _create_parser(): action="store_true", help="dump generated metadata and exit", ) + parser.add_argument( + "--debug", + action="store_true", + help="enable debug mode, which increase log verbosity, etc." + ) return parser @@ -247,6 +252,8 @@ def main(argv=None): def _main(args, argv): + if args.debug: + logger.setLevel(logging.DEBUG) sourcedir_absolute = os.path.abspath(args.sourcedir) confdir_absolute = ( os.path.abspath(args.confdir) From 113511abb7c39ee9433bc6cdf302401665e6b279 Mon Sep 17 00:00:00 2001 From: Nicola Coretti Date: Fri, 15 Nov 2024 15:16:19 +0100 Subject: [PATCH 2/5] Fix reference selection and default filters --- exasol/toolbox/sphinx/multiversion/main.py | 20 ++++++++++++++------ exasol/toolbox/sphinx/multiversion/sphinx.py | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/exasol/toolbox/sphinx/multiversion/main.py b/exasol/toolbox/sphinx/multiversion/main.py index 9abeb27d9..9dedb03e2 100644 --- a/exasol/toolbox/sphinx/multiversion/main.py +++ b/exasol/toolbox/sphinx/multiversion/main.py @@ -59,7 +59,7 @@ def load_sphinx_config_worker(q, confpath, confoverrides, add_defaults): ) current_config.add( "smv_branch_whitelist", - sphinx.DEFAULT_TAG_WHITELIST, + sphinx.DEFAULT_BRANCH_WHITELIST, "html", str, ) @@ -286,13 +286,13 @@ def _main(args, argv): conffile = os.path.join(confdir, "conf.py") # Get git references - gitrefs = git.get_refs( + gitrefs = list(git.get_refs( str(gitroot), config.smv_tag_whitelist, config.smv_branch_whitelist, config.smv_remote_whitelist, files=(sourcedir, conffile), - ) + )) # Order git refs if config.smv_prefer_remote_refs: @@ -581,14 +581,22 @@ def _main(args, argv): with open( os.path.join(args.outputdir, "index.html"), "w", encoding="utf-8" ) as f: - versions = [ + logger.debug("Picked up Git references: %s", [ref.name for ref in gitrefs]) + tag_versions = [ ref.name for ref in gitrefs if re.match(config.smv_tag_whitelist, ref.name) ] - versions = sorted( - versions, key=lambda v: ExasolVersion.from_string(v), reverse=True + tag_versions = sorted( + tag_versions, key=lambda v: ExasolVersion.from_string(v), reverse=True ) + branches = [ + ref.name + for ref in gitrefs + if re.match(config.smv_branch_whitelist, ref.name) + ] + versions = branches + tag_versions + logger.debug("Selected versions for documentation: %s", versions) f.write(template.render(version=versions[0])) return 0 diff --git a/exasol/toolbox/sphinx/multiversion/sphinx.py b/exasol/toolbox/sphinx/multiversion/sphinx.py index 439e2833f..18fb15488 100644 --- a/exasol/toolbox/sphinx/multiversion/sphinx.py +++ b/exasol/toolbox/sphinx/multiversion/sphinx.py @@ -16,7 +16,7 @@ DATE_FMT = "%Y-%m-%d %H:%M:%S %z" DEFAULT_TAG_WHITELIST = r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$" -DEFAULT_BRANCH_WHITELIST = r"master|main" +DEFAULT_BRANCH_WHITELIST = r"^(master|main)" DEFAULT_REMOTE_WHITELIST = None DEFAULT_RELEASED_PATTERN = r"^tags/.*$" DEFAULT_OUTPUTDIR_FORMAT = r"{ref.name}" From ee957889b307ec0bc5bdef4fa4e0d86c54ce9b7e Mon Sep 17 00:00:00 2001 From: Nicola Coretti Date: Fri, 15 Nov 2024 15:23:59 +0100 Subject: [PATCH 3/5] Update changelog --- doc/changes/unreleased.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/changes/unreleased.md b/doc/changes/unreleased.md index 24c21d053..e69a303ed 100644 --- a/doc/changes/unreleased.md +++ b/doc/changes/unreleased.md @@ -1,8 +1,10 @@ -# Unreleased +j Unreleased ## 🐞 Fixed * Fixed the issue with publishing new documentation after releasing a new version +* Fixed the issue where master/main was not part of the multiversion documentation + ## ✨ Added * #149: Added nox task to lint imports From 48a37e61840524c96a57b9b30c10278e1abd0243 Mon Sep 17 00:00:00 2001 From: Nicola Coretti Date: Mon, 18 Nov 2024 07:49:11 +0100 Subject: [PATCH 4/5] Update exasol/toolbox/sphinx/multiversion/main.py Co-authored-by: Christoph Kuhnke --- exasol/toolbox/sphinx/multiversion/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exasol/toolbox/sphinx/multiversion/main.py b/exasol/toolbox/sphinx/multiversion/main.py index 9dedb03e2..addcf3f73 100644 --- a/exasol/toolbox/sphinx/multiversion/main.py +++ b/exasol/toolbox/sphinx/multiversion/main.py @@ -231,7 +231,7 @@ def _create_parser(): parser.add_argument( "--debug", action="store_true", - help="enable debug mode, which increase log verbosity, etc." + help="enable debug mode with increased log verbosity, etc." ) return parser From ff111e8ce45dac2bae1ffb27e3efd681d5eed3b3 Mon Sep 17 00:00:00 2001 From: Nicola Coretti Date: Mon, 18 Nov 2024 08:30:21 +0100 Subject: [PATCH 5/5] Update doc/changes/unreleased.md --- doc/changes/unreleased.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes/unreleased.md b/doc/changes/unreleased.md index e69a303ed..1bdf218ff 100644 --- a/doc/changes/unreleased.md +++ b/doc/changes/unreleased.md @@ -1,4 +1,4 @@ -j Unreleased +# Unreleased ## 🐞 Fixed