为了构建 readthedocs,我需要安装一些要求。这些 pip 要求之一需要 cmake 和 swig 来构建。
在这种情况下是否仍然可以使用 readthedocs?
请您参考如下方法:
似乎已经有一个关于此的已归档问题:https://github.com/rtfd/readthedocs.org/issues/2094
它包含一个解决方法:
For anyone else running into this it seems you can also hack around it using the 'READTHEDOCS' env var to conditionally modify
install_requiresin yoursetup.py.
这指向:
When RTD builds your project, it sets the
READTHEDOCSenvironment variable to the string True. So within your Sphinxconf.pyfile, you can vary the behavior based on this. For example:
import os
on_rtd = os.environ.get('READTHEDOCS') == 'True'
if on_rtd:
html_theme = 'default'
else:
html_theme = 'nature'
OTOH,最后一条评论声称它应该适用于当前的 RTD 版本。
