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
.
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
@jairoruizsaenz , I believe this is the bit you want:
https://github.com/fairlearn/fairlearn/blob/44244c6a513eb9b8446369d3c92dce4adf1e4f7e/docs/conf.py#L39
Thanks @riedgar-ms