[英]What does `python setup.py check` actually do?
python setup.py check
究竟做了什么?
第一站, distutils
包文档 :
check命令对包的元数据执行一些测试。 例如,它验证所有必需的元数据是作为传递给
setup()
函数的参数提供的。
因此,它会测试您是否正确填写了元数据; 在创建Python包时将其视为质量控制步骤。
接下来,我们可以检查命令行是否提供任何帮助:
$ 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
因此,我们可以检查元数据并将长描述验证为reStructuredText。 后者要求您安装了docutils
:
$ python setup.py check -rs
running check
error: The docutils package is needed.
如果确实安装了它并且没有问题,则脚本只运行并退出而不显示任何消息:
$ python setup.py check -r
running check
但如果缺少必需的元数据,则会收到警告消息:
$ 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
如果给出-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.
默认情况下, -m
已启用, -r
和-s
已禁用。
另请参阅命令源代码 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.