Skip to content

Commit dcd3609

Browse files
nnobeliststeenbe
authored andcommitted
Filter out empty values from install_requires
Sometimes, when the `--analyze-setup-py-insecurely` parameter is used, the requirements resolution can contain some empty elements. For instance for gnupg-2.3.1/gnupg-2.3.1/setup.py, the requirements are resolved to ['psutil>=1.2.1', '']. The second element of this array crashes the Python Inspector. This commit fixes the issue by removing empty elements from the array. Resolves #247. Signed-off-by: Nicolas Nobelis <[email protected]>
1 parent 7238a61 commit dcd3609

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/python_inspector/setup_py_live_eval.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def iter_requirements(level, extras, setup_file):
121121

122122
mock_args, mock_kwargs = mock_setup.call_args
123123
install_requires = mock_kwargs.get("install_requires", install_requires)
124+
install_requires = [req for req in install_requires if req]
124125

125126
requires_extras = mock_kwargs.get("extras_require", requires_extras)
126127
test_requires = mock_kwargs.get("test_requires", test_requires)

0 commit comments

Comments
 (0)