try:
with open(requirements_file_path, "rb") as fp:
for line in fp:
pkg_resources.require(line)
except (pkg_resources.DistributionNotFound,
pkg_resources.VersionConflict) as e:
// In newer versions of setuptools, these exception classes have a report
// method that provides a readable description of the error.
After Change
requirements_file_path: string. Path to a pip requirements file.
with open(requirements_file_path, "rb") as fp:
requirements_to_check = [(requirements_file_path, deque(fp.readlines()))]
try:
while requirements_to_check:
file_path, lines = requirements_to_check.pop()
while lines:
line = lines.popleft().strip()
if line.startswith("-r"):
requirements_to_check.append((file_path, lines))
file_path = os.path.join(os.path.dirname(file_path), line[2:])