Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added handling of requirement file lines that include other requireme…

…nts files.
  • Loading branch information...
commit 9af62f49172e90534c8ec42e91404e6ca17baf1a 1 parent dcb1c2e
@jessamynsmith jessamynsmith authored committed
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/piplint/__init__.py
View
12 src/piplint/__init__.py
@@ -6,6 +6,7 @@
:license: Apache License 2.0, see LICENSE for more details.
"""
+import os
import re
import sys
from pkg_resources import parse_version
@@ -95,6 +96,17 @@ def valid_version(version, compare, r_version):
continue
frozen_reqs.append(parse_package_line(line))
+ # Requirements files may include other requirements files;
+ # if so, add to list.
+ included_files = []
+ for file in requirement_files:
+ path = os.path.dirname(file)
+ args = "grep '^\-r' %s" % file
+ grep = Popen([args], stdout=PIPE, shell=True)
+ for line in grep.communicate()[0].splitlines():
+ included_files.append(os.path.join(path, line[2:].lstrip()))
+ requirement_files.extend(included_files)
+
for fname in requirement_files:
with open(fname) as fp:
for line in fp:
Please sign in to comment.
Something went wrong with that request. Please try again.