Fix _pymod2pkg_translate when skip_pyversion is None

[1] ensured proper order for py_vers when using pymod2pkg, however
it did not consider the chance that skip_pyversion is None. In this
case, it failed with:

TypeError: argument of type 'NoneType' is not iterable

This patch ensures that it works even when skip_pyversion is None.

[1] - https://review.opendev.org/662719

Change-Id: Iac7dda35b44edf4a7af31129d9055280aa37df01
This commit is contained in:
Javier Pena 2019-06-06 11:47:33 +02:00
parent 110c29133b
commit 10dba17495

View File

@ -153,9 +153,8 @@ def _pymod2pkg_translate(pkg_name, context, py_versions):
py_versions = [py_versions]
kwargs = {}
if py_versions:
kwargs['py_vers'] = [
i for i in py_versions if i not in context['skip_pyversion']
]
kwargs['py_vers'] = [i for i in py_versions if i not in
set((context['skip_pyversion'],))]
translations = pymod2pkg.module2package(
pkg_name, context['spec_style'], **kwargs)