[英]What does `python setup.py check` actually do?
python setup.py check
究竟做了什么?
First stop, the distutils
package documentation : 第一站, distutils
包文档 :
The check command performs some tests on the meta-data of a package. check命令对包的元数据执行一些测试。 For example, it verifies that all required meta-data are provided as the arguments passed to the
setup()
function. 例如,它验证所有必需的元数据是作为传递给setup()
函数的参数提供的。
So it tests if you have filled in your metadata correctly; 因此,它会测试您是否正确填写了元数据; see it as a quality control step when creating a Python package. 在创建Python包时将其视为质量控制步骤。
Next, we can check if the command line offers any help: 接下来,我们可以检查命令行是否提供任何帮助:
$ python setup.py --help-commands | grep check
check perform some checks on the package
$ python setup.py check --help
# ...
Options for 'check' command:
--metadata (-m) Verify meta-data
--restructuredtext (-r) Checks if long string meta-data syntax are
reStructuredText-compliant
--strict (-s) Will exit with an error if a check fails
So we can check for metadata and validate the long description as reStructuredText. 因此,我们可以检查元数据并将长描述验证为reStructuredText。 The latter requires that you have docutils
installed: 后者要求您安装了docutils
:
$ python setup.py check -rs
running check
error: The docutils package is needed.
If you do have it installed and there are no problems, the script just runs and exits with no messages: 如果确实安装了它并且没有问题,则脚本只运行并退出而不显示任何消息:
$ python setup.py check -r
running check
but if required metadata is missing you get warning messages: 但如果缺少必需的元数据,则会收到警告消息:
$ python setup.py check -r
running check
warning: check: missing required meta-data: url
warning: check: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied
which becomes an error if you have the -s
flag given: 如果给出-s
标志,则会出错:
$ python setup.py check -rs
running check
warning: check: missing required meta-data: url
warning: check: missing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied
error: Please correct your package.
By default, -m
is enabled, -r
and -s
are disabled. 默认情况下, -m
已启用, -r
和-s
已禁用。
Also see the command source code . 另请参阅命令源代码 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.