How should I solve the conflict of OptionParser and sphinx-build in a large project?

蓝咒 提交于 2020-01-04 06:51:58

问题


I have a large Python project with many external libraries I don't want to touch and I want to generate the documentation with sphinx. My problem is, whenever I execute "make html", I get this error:

...
usage: sphinx-build [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: sphinx-build --help [cmd1 cmd2 ...]
   or: sphinx-build --help-commands
   or: sphinx-build cmd --help

error: option -b not recognized
make: *** [html] Fehler 1

I already figured out that this problem occurs when there is an OptionParser in some of the directories that I want to document (Is OptionParser in conflict with sphinx?). I actually have many scripts that use the OptionParser in those directories and do not wrap it with if __name__ == "__main__": .... My question is:

How can I generate the documentation without touching any of these scripts?

Is there a way to exclude those files/paths? I already tried exclude_patterns in my conf.py but this did not work. I do not know why. Is there a way to catch that error?

Update

The issue turned out to be a setup.py file in the tree parsed by autodoc.

来源:https://stackoverflow.com/questions/14769962/how-should-i-solve-the-conflict-of-optionparser-and-sphinx-build-in-a-large-proj

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!