8
python setup.py check
實際上做了什麼?`python setup.py check`實際上做了什麼?
python setup.py check
實際上做了什麼?`python setup.py check`實際上做了什麼?
第一站,所述distutils
package documentation:
校驗命令執行在封裝的元數據中的一些測試。例如,它驗證所有需要的元數據是作爲傳遞給
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
被禁用。
另請參閱command source code。