From 96873bcf877307f1b6b0a181f395bcc20b600ce3 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Tue, 6 Feb 2024 13:04:05 +0000 Subject: [PATCH] doc/conf.py: Fetch origin when building the doc --- doc/conf.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 132cae867..af76fe703 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -55,18 +55,25 @@ for name, obj in vars(unittest).items(): RTD = (os.getenv('READTHEDOCS') == 'True') -# For ReadTheDocs only: source init_env and get all env var defined by it. -if RTD: - # RTD makes a shallow clone by default, so make sure to have the whole +def prepare(): + + def run(cmd, **kwargs): + return subprocess.run( + cmd, + cwd=LISA_HOME, + **kwargs, + ) + + # In case we have a shallow clone, make sure to have the whole # history to be able to generate breaking change list and any other # git-based documentation - subprocess.run(['git', 'fetch', '--unshallow'], check=False) - subprocess.run(['git', 'fetch', '--tags'], check=False) + run(['git', 'fetch', '--unshallow'], check=False) + run(['git', 'fetch', '--tags'], check=False) # Ensure we have the changelog notes that supplement commit messages, as # sometimes the markers such as FEATURE were forgotten and later added # using git notes. - subprocess.run(['git', 'fetch', 'origin', 'refs/notes/changelog']) + run(['git', 'fetch', 'origin', 'refs/notes/changelog']) source_env = { **os.environ, @@ -92,6 +99,8 @@ if RTD: ) os.environ.update(json.loads(out)) +prepare() + # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -- GitLab