extend missing-releases to look at pypi

Extend the missing-releases command to look at PyPI for uploads there.

Change-Id: I5693686bbe46a4ec90944bbf2fa81e1c5c91749e
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-01-29 10:07:01 -05:00
parent ceeb3cea0d
commit 6c7a19708b
2 changed files with 34 additions and 0 deletions

View File

@ -29,6 +29,7 @@ from requests.packages import urllib3
from openstack_releases import defaults
from openstack_releases import gitutils
from openstack_releases import links
from openstack_releases import pythonutils
from openstack_releases import yamlutils
urllib3.disable_warnings()
@ -164,6 +165,19 @@ def main():
project) + '.asc',
)
)
sdist_name = pythonutils.guess_sdist_name(project)
pypi_info = pythonutils.get_pypi_info(sdist_name)
if release['version'] not in pypi_info.get('releases', {}):
msg = ('{} dist with version {} '
'not uploaded to PyPI').format(
sdist_name, release['version'])
print(' {}'.format(msg))
errors.append(msg)
else:
print(' found version {} on PyPI'.format(
release['version']))
print()
if errors:

View File

@ -12,10 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import os
import os.path
import subprocess
import requests
LOG = logging.getLogger(__name__)
def get_sdist_name(workdir, repo):
"Check out the code."
@ -46,3 +51,18 @@ def get_sdist_name(workdir, repo):
print('Results: %s' % (out,))
name = out.splitlines()[-1].strip()
return name
def guess_sdist_name(project):
"Guess the name without checking out the repo."
repo_base = project['repo'].rsplit('/')[-1]
base = project.get('tarball-base', repo_base)
return base
def get_pypi_info(dist_name):
"Return PyPI information for the distribution."
LOG.debug('looking at PyPI for {}'.format(dist_name))
url = 'https://pypi.python.org/pypi/{}/json'.format(dist_name)
LOG.debug(url)
return requests.get(url).json()