sphinx-contrib/multiversion

Can conf.py detect the version currently being built?

Closed this issue · 8 comments

It appears that the shared conf.py is invoked from the version from which sphinx-multiversion was run, rather than the current target version.

While I know that sphinx-multiversion applies the same conf.py (the one from the version where sphinx-multiversion was run) to all versions being built, I do need to make some changes based on the current target version. However, including lines such as:

print(fairlearn.__version__)
print(os.getcwd())

show that conf.py is being run solely from the directory of the version where sphinx-multiversion was run.

Is there some other way in which conf.py can discover the value of smv_current_version (as I've seen in the stacktrace when the builds fail due to the required conf.py changes not being made)?

I have tried running sphinx-multiversion with:

sphinx-multiversion.exe .\docs\ build/html -D 'current_source_dir=${sourcedir}'

but this just produces a warning unknown config value 'current_source_dir' in override, ignoring even if I put current_source_dir="NOTSET" in my conf.py.

Please check #41. This sets some env vars that you can query using os.getenv().

Thanks - I'm able to get the information about the version currently being built.

Thanks - I'm able to get the information about the version currently being built.

Hi @riedgar-ms, would you mind sharing how you did it?, I've been trying to do the same and I can't make it work

Hey @Holzhaus, I want to use the env var for a versioned-doc we are generating. But it looks like this #41 was added after the v0.2.4 release. Could you please push a new version to pypi?

@Holzhaus , I would also appreciate a new version pushed to pypi.