How to turn warnings into errors when building sphinx documentation with setuptools?

后端 未结 3 1530
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 15:45

I am using setuptools to build my sphinx documentation of a python project (python setup.py build_sphinx).

As found on, e.g., this site, I have configured t

3条回答
  •  走了就别回头了
    2021-02-19 16:36

    The only solution I can manage is both simple and sub-optimal.

    Change from:

    python setup.py build_sphinx
    

    to:

    python -W error setup.py build_sphinx
    

    That will turn all warnings into errors, including errors from setuptools, etc., which isn't exactly what you want, but it will stop on sphinx errors.

    If you're doing this to try and set up Continuous Integration or something, maybe this is good enough?

    UPDATE: See stephenfin's answer if using Sphinx 1.5+

提交回复
热议问题