简体   繁体   中英

Readthedocs build: cmake/swig are not available

In order to build in readthedocs, I need to install some requirements. One of these pip requirements needs cmake and swig to build.

Is it still possible to use readthedocs in this scenario?

Seems there is a filed issue about this already: https://github.com/rtfd/readthedocs.org/issues/2094

It contains a workaround:

For anyone else running into this it seems you can also hack around it using the 'READTHEDOCS' env var to conditionally modify install_requires in your setup.py .

This points to:

When RTD builds your project, it sets the READTHEDOCS environment variable to the string True. So within your Sphinx conf.py file, 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, the last comment claims it should work fine with the current RTD version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM