diff --git a/grayskull/pypi/pypi.py b/grayskull/pypi/pypi.py index 1aa770fe8..9ea42e3ce 100644 --- a/grayskull/pypi/pypi.py +++ b/grayskull/pypi/pypi.py @@ -218,10 +218,13 @@ def __fake_distutils_setup(*args, **kwargs): def _fix_list_requirements(key_deps: str) -> List: """Fix when dependencies have lists inside of another sequence""" - if not kwargs.get(key_deps): - return kwargs.get(key_deps) + val_deps = kwargs.get(key_deps) + if not val_deps: + return val_deps list_req = [] - for val in kwargs.get(key_deps): + if isinstance(val_deps, str): + val_deps = [val_deps] + for val in val_deps: if isinstance(val, (tuple, list)): list_req.extend(list(map(str, val))) else: diff --git a/tests/test_pypi.py b/tests/test_pypi.py index 546d71492..ed5036f65 100644 --- a/tests/test_pypi.py +++ b/tests/test_pypi.py @@ -226,6 +226,16 @@ def test_injection_distutils_compiler_gsw(): assert data["packages"] == ["gsw"] +def test_injection_distutils_setup_reqs_ensure_list(): + pkg_name, pkg_ver = "pyinstaller-hooks-contrib", "2020.7" + recipe = PyPi(name=pkg_name, version=pkg_ver) + data = recipe._get_sdist_metadata( + f"https://pypi.io/packages/source/p/{pkg_name}/{pkg_name}-{pkg_ver}.tar.gz", + pkg_name, + ) + assert data.get("setup_requires") == ["setuptools >= 30.3.0"] + + def test_merge_pypi_sdist_metadata(): recipe = PyPi(name="gsw", version="3.3.1") pypi_metadata = recipe._get_pypi_metadata(name="gsw", version="3.3.1")