Che cosa fa esattamente lo python setup.py check
?Cosa fa effettivamente `python setup.py check`?
risposta
Prima tappa, il distutils
package documentation:
Il comando di controllo esegue alcuni test sui meta-dati di un pacchetto. Ad esempio, verifica che tutti i meta-dati richiesti siano forniti come argomenti passati alla funzione
setup()
.
Quindi verifica se i metadati sono stati compilati correttamente; vederlo come una fase di controllo della qualità durante la creazione di un pacchetto Python.
Avanti, siamo in grado di verificare se la riga di comando offre alcun aiuto:
$ 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
in modo che possiamo verificare la presenza di metadati e convalida la descrizione finché reStructuredText. Quest'ultimo richiede di avere docutils
installato:
$ python setup.py check -rs
running check
error: The docutils package is needed.
Se non avete installato e non ci sono problemi, lo script appena viene eseguito e le uscite senza messaggi:
$ python setup.py check -r
running check
ma se metadati richiesti è si ottiene mancanti messaggi di avviso:
$ 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
che diventa un errore se si ha la bandiera -s
dato:
$ 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.
Per impostazione predefinita, -m
è abilitato, -r
e -s
sono disabilitati.
Vedere anche command source code.