update missing-releases to handle non-python projects better

Skip the PyPI checks for things that are not python modules.

Change-Id: I15b0e42c961f7fae600f88ffe23edc22d1f98922
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-02-08 15:22:02 -05:00
parent 87c2cf5ddf
commit 59a998da02
2 changed files with 13 additions and 3 deletions

View File

@ -127,8 +127,16 @@ def main():
# Look for the tarball associated with the tag and
# report if that exists.
if link_mode == 'tarball':
tb_url = links.tarball_url(version, project)
errors.extend(check_signed_file('tarball', tb_url))
sdist_name = pythonutils.guess_sdist_name(project)
pypi_info = pythonutils.get_pypi_info(sdist_name)
if not pypi_info:
print(' apparently not a python module')
continue
wheel_2_errors = list(
check_url(
'python 2 wheel',
@ -168,8 +176,6 @@ def main():
)
)
sdist_name = pythonutils.guess_sdist_name(project)
pypi_info = pythonutils.get_pypi_info(sdist_name)
if version not in pypi_info.get('releases', {}):
msg = ('{} dist with version {} '
'not uploaded to PyPI').format(

View File

@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import logging
import os
import os.path
@ -66,4 +67,7 @@ def get_pypi_info(dist_name):
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()
try:
return requests.get(url).json()
except json.decoder.JSONDecodeError:
return {}