Я использую setuptools для создания моей документации по сфинксу проекта python (python setup.py build_sphinx
).Как включить предупреждения в ошибки при создании документации sphinx с помощью setuptools?
Как найти на, например, this site, я настроил процесс сборки с помощью setup.cfg:
[build_sphinx]
source-dir = docs/source
build-dir = docs/build
all_files = 1
Однако, я хотел бы добавить еще несколько вариантов. В частности, я хотел бы, чтобы включить все предупреждения в ошибки, которые будут работать с командой sphinx-build
с опцией -W
:
sphinx-build --help
Sphinx v1.1.3
Usage: /usr/bin/sphinx-build [options] sourcedir outdir [filenames...]
Options: -b <builder> -- builder to use; default is html
-a -- write all files; default is to only write new and changed files
-E -- don't use a saved environment, always read all files
-t <tag> -- include "only" blocks with <tag>
-d <path> -- path for the cached environment and doctree files
(default: outdir/.doctrees)
-c <path> -- path where configuration file (conf.py) is located
(default: same as sourcedir)
-C -- use no config file at all, only -D options
-D <setting=value> -- override a setting in configuration
-A <name=value> -- pass a value into the templates, for HTML builder
-n -- nit-picky mode, warn about all missing references
-N -- do not do colored output
-q -- no output on stdout, just warnings on stderr
-Q -- no output at all, not even warnings
-w <file> -- write warnings (and errors) to given file
-W -- turn warnings into errors
-P -- run Pdb on exception
Modi:
* without -a and without filenames, write new and changed files.
* with -a, write all files.
* with filenames, write these.
Я не вижу подобный вариант для python setup.py build_sphinx
:
python setup.py build_sphinx --help
Common commands: (see '--help-commands' for more)
setup.py build will build the package underneath 'build/'
setup.py install will install the package
Global options:
--verbose (-v) run verbosely (default)
--quiet (-q) run quietly (turns verbosity off)
--dry-run (-n) don't actually do anything
--help (-h) show detailed help message
--no-user-cfg ignore pydistutils.cfg in your home directory
Options for 'BuildDoc' command:
--fresh-env (-E) discard saved environment
--all-files (-a) build all files
--source-dir (-s) Source directory
--build-dir Build directory
--config-dir (-c) Location of the configuration directory
--builder (-b) The builder to use. Defaults to "html"
--project The documented project's name
--version The short X.Y version
--release The full version, including alpha/beta/rc tags
--today How to format the current date, used as the replacement
for |today|
--link-index (-i) Link index.html to the master doc
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
ли кто-нибудь знаете ли, если все предупреждения в случае ошибок могут быть достигнуты при создании документа sphinx с помощью setuptools?
Edit:
Опция -W
не распознается Setuptools:
python setup.py build_sphinx -W
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option -W not recognized
Что происходит с 'python setup.py build_sphinx -W'? – jonrsharpe
Этот аргумент [доступен для 'sphinx-build'] (http://www.sphinx-doc.org/en/stable/invocation.html#cmdoption-sphinx-build-W), но, по-видимому, нельзя установить [в 'conf.py'] (http://www.sphinx-doc.org/en/stable/config.html) и не является одним из вариантов ваших исходных списков для' [build_sphinx] '. Если передача аргумента командной строки явно не работает, я бы предположил, что это невозможно сделать таким образом. Альтернативой может быть поиск того, можно ли использовать 'cmdclass' в' setup.py' и указать аргументы таким образом. – jonrsharpe
@jonrsharpe: 'python setup.py build_sphinx -W' дает ошибку" опция -W not detected ". – Thomas