diff --git a/doc/conf.py b/doc/conf.py index 132cae867751d4e58f730f87e0291a4ceffbf01d..af76fe703bdc18dbf79f0726387c5fe947a994bb 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.