PY-18851 Fixed: RequirementParseError: Invalid requirement, parse error at ... for packages with broken requiremnts

Some setuptools versions throws RequirementParseError while getting package dependencies
This commit is contained in:
Semyon Proshev
2016-04-18 14:03:13 +03:00
parent 16f4b4c883
commit c55dd274ea
+5 -1
View File
@@ -46,7 +46,11 @@ def do_list():
except ImportError:
error("Python packaging tool 'setuptools' not found", ERROR_NO_SETUPTOOLS)
for pkg in pkg_resources.working_set:
requires = ':'.join([str(x) for x in pkg.requires()])
try:
requirements = pkg.requires()
except Exception:
requirements = []
requires = ':'.join([str(x) for x in requirements])
sys.stdout.write('\t'.join([pkg.project_name, pkg.version, pkg.location, requires])+chr(10))
sys.stdout.flush()