diff options
author | 2023-05-06 20:09:19 +0100 | |
---|---|---|
committer | 2023-05-31 13:03:54 +0100 | |
commit | ed602405df8e4ddf9e7993e42eea9a5e9afd4856 (patch) | |
tree | 3c2284b9d1ef15fa423875be832207b2a06ca291 /docs/conf.py | |
parent | Bump action step versions in CI (diff) |
Apply fixes for ruff linting
Diffstat (limited to 'docs/conf.py')
-rw-r--r-- | docs/conf.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/conf.py b/docs/conf.py index 2fea7264..23636774 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,7 @@ # Configuration file for the Sphinx documentation builder. # https://www.sphinx-doc.org/en/master/usage/configuration.html +import contextlib import functools import os.path import shutil @@ -16,7 +17,7 @@ from sphinx.application import Sphinx logger = sphinx.util.logging.getLogger(__name__) # Handle the path not being set correctly in actions. -sys.path.insert(0, os.path.abspath('..')) +sys.path.insert(0, os.path.abspath("..")) from docs import utils # noqa: E402 @@ -209,10 +210,9 @@ smv_latest_version = "main" smv_branch_whitelist = "main" if os.getenv("BUILD_DOCS_FOR_HEAD", "False").lower() == "true": if not (branch := os.getenv("BRANCH_NAME")): - try: + with contextlib.suppress(git.InvalidGitRepositoryError): branch = git.Repo(PROJECT_ROOT).active_branch.name - except git.InvalidGitRepositoryError: - pass + if branch: logger.info(f"Adding branch {branch} to build whitelist.") |