Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiversion build #279

Merged
merged 6 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion doc/changes/unreleased.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Unreleased
j Unreleased

Nicoretti marked this conversation as resolved.
Show resolved Hide resolved
## 🐞 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
Expand Down
27 changes: 21 additions & 6 deletions exasol/toolbox/sphinx/multiversion/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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 with increased log verbosity, etc."
)
return parser


Expand All @@ -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)
Expand Down Expand Up @@ -279,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:
Expand Down Expand Up @@ -574,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
2 changes: 1 addition & 1 deletion exasol/toolbox/sphinx/multiversion/sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
Loading