Use recommended twine check for README validation

The use of ``python setup.py check -r -s`` is actually deprecated and
the recommended method for validating a README for PyPi upload is to
build the sdist and wheel and run ``twine check $DIST_PATH``. This
switches our validation check to use the supported method.

Change-Id: I321b8cf6f1e2116d2fe23059d5f13aa6f2ae8b4c
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2019-04-05 10:56:16 -05:00
parent 15021ad4ca
commit 5359acf788
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
3 changed files with 11 additions and 3 deletions

View File

@ -1774,8 +1774,9 @@ def main():
validate_model,
validate_release_type,
validate_pypi_permissions,
validate_pypi_readme,
validate_build_sdist,
# Check readme after sdist build to slightly optimize things
validate_pypi_readme,
validate_gitreview,
validate_release_sha_exists,
validate_existing_tags,

View File

@ -94,10 +94,16 @@ def check_readme_format(workdir, repo):
LOG.debug('did not find %s, maybe %s is not a python project',
setup_path, repo)
return None
# Check if the sdist build has been done
build_path = os.path.join(dest, 'dist')
if not os.path.exists(build_path):
build_sdist(workdir, repo)
# NOTE(dhellmann): This relies on validate being run via tox so
# that python3 is present and the docutils package is installed.
# that python3 is present and the twine package is installed.
processutils.check_call(
['python3', 'setup.py', 'check', '--restructuredtext', '--strict'],
['twine', 'check', os.path.join(build_path, '*')],
cwd=dest,
)

View File

@ -21,6 +21,7 @@ prompt_toolkit>=2.0.7
tqdm
mwclient==0.8.1
jsonschema>=2.6.0
twine>=1.13.0
# For release notes generation.
Jinja2>=2.6 # BSD License (3 clause)