如何配置buildout以使用bin/sphinxbuilder创建sphinx文档

Dan*_*ski 10 python buildout python-sphinx

在我的buildout.cfg文件中,我有这样的代码:

parts =
    ...
    sphinxbuilder
Run Code Online (Sandbox Code Playgroud)

下一个在同一档案中:

eggs=
   ...
   jinja2
   markupsafe
   sphinx
Run Code Online (Sandbox Code Playgroud)

然后,在文件的末尾:

[sphinxbuilder]
recipe = collective.recipe.sphinxbuilder
source = ${buildout:directory}/docs-src
build = ${buildout:directory}/docs
Run Code Online (Sandbox Code Playgroud)

我做:

bin/buildout
Run Code Online (Sandbox Code Playgroud)

它给出了输出(通常:OK):

Updating sphinxbuilder.
collective.recipe.sphinxbuilder: writing MAKEFILE..
collective.recipe.sphinxbuilder: writing BATCHFILE..
collective.recipe.sphinxbuilder: writing custom sphinx-builder script..
Run Code Online (Sandbox Code Playgroud)

在鸡蛋文件夹中我有Sphinxeeg.

之后buildout,在项目目录下我有一个新目录:docs.然后我运行命令:

bin/sphinx-quickstart
Run Code Online (Sandbox Code Playgroud)

就像root path for the documentation我设定的那样docs

然后我编辑docs/conf.py并取消注释

sys.path.insert(0, os.path.abspath('.'))
Run Code Online (Sandbox Code Playgroud)

我运行命令bin/sphinxbuilder并得到错误:

Makefile:12: *** The 'sphinx-build' command was not found. 
Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the 'sphinx-build' executable.
Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/. Stop.
Run Code Online (Sandbox Code Playgroud)

主要问题:(1)如何通过扩建自动进行狮身人面像的工作?(2)如何在.rst文件中设置项目模块(apps)的正确路径?(3)conf.py文件放在哪里?

A S*_*ipt 1

在 windows 上,但我似乎记得类似的问题。

扩展以下 cfg 可确保两件事:1) 我们生成的所有入口点都可以访问 sphinx Eggs 2) 依赖于 sphinx 入口点的部分将在生成这些入口点之后执行

[sphinx]
eggs = 
    sphinx
    <if you have theme eggs or other extensions, put em here>

parts =
    sphinx.console_scripts

[sphinx.console_scripts]
recipe = zc.recipe.egg
dependent-scripts = true
eggs = 
    ${sphinx.eggs}
    ${buildout:eggs}
Run Code Online (Sandbox Code Playgroud)

使用此功能,您还可以添加依赖于 build/apidoc 可执行文件的部分,并且您的文档生成将成为一键构建的一部分:

[sphinx.apidoc]
recipe = plone.recipe.command
command = ${buildout:bin-directory}\sphinx-apidoc.exe <all your flags/settiongs based on buildout>
Run Code Online (Sandbox Code Playgroud)