Fix create_pygmentize_bundle

If the bdist_wheel release was not first, then it would throw an
exception without looking at the other packages.

Change-Id: Iac1f94f1401c4a6a8ec8691a558024800b0e7269
This commit is contained in:
Kunal Mehta 2019-01-09 14:43:22 -08:00
parent b4a80cd365
commit 4bd5a881ff

View file

@ -30,13 +30,15 @@ PYGMENTIZE_LAUNCHER = textwrap.dedent('''\
print('Querying PyPI for the latest Pygments release...')
pypi = xmlrpc.client.ServerProxy('https://pypi.python.org/pypi')
latest_version = pypi.package_releases('Pygments')[0]
url = None
for release in pypi.release_urls('Pygments', latest_version):
if (release['packagetype'] == 'bdist_wheel' and
release['python_version'].startswith('py2')):
url = release['url']
md5_digest = release['md5_digest']
break
else:
if not url:
raise RuntimeError('No suitable package found.')
print('Retrieving version %s (%s)...' % (latest_version, url))