This commit is contained in:
2018-03-11 14:29:34 -04:00
parent a9e1c11d88
commit 96e054aea1
+24 -16
View File
@@ -306,23 +306,31 @@ class Resolver(object):
log.debug(' {:25} requires {}'.format(format_requirement(ireq),
', '.join(sorted(dependency_strings, key=lambda s: s.lower())) or '-'))
from notpip._vendor.packaging.markers import InvalidMarker
for dependency_string in dependency_strings:
individual_dependencies = [dep.strip() for dep in dependency_string.split(', ')]
cleaned_deps = []
for dep in individual_dependencies:
tokens = [token.strip() for token in dep.split(';')]
cleaned_tokens = []
markers = []
if len(tokens) == 1:
cleaned_deps.append(tokens[0])
continue
markers = list(set(tokens[1:]))
cleaned_tokens.append(tokens[0])
if markers:
cleaned_tokens.extend(markers)
cleaned_deps.append('; '.join(cleaned_tokens))
dependency_string = ', '.join(set(cleaned_deps))
yield InstallRequirement.from_line(dependency_string, constraint=ireq.constraint)
try:
individual_dependencies = [dep.strip() for dep in dependency_string.split(', ')]
cleaned_deps = []
for dep in individual_dependencies:
tokens = [token.strip() for token in dep.split(';')]
cleaned_tokens = []
markers = []
if len(tokens) == 1:
cleaned_deps.append(tokens[0])
continue
markers = list(set(tokens[1:]))
cleaned_tokens.append(tokens[0])
if markers:
cleaned_tokens.extend(markers)
cleaned_deps.append('; '.join(cleaned_tokens))
_dependency_string = ', '.join(set(cleaned_deps))
yield InstallRequirement.from_line(_dependency_string, constraint=ireq.constraint)
except InvalidMarker:
yield InstallRequirement.from_line(dependency_string, constraint=ireq.constraint)
def reverse_dependencies(self, ireqs):