Skip to content

Commit

Permalink
Make vendoring task respond well to empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Jan 30, 2021
1 parent d1aa391 commit 3d21ddc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,14 @@ def vendoring(session):
return

def pinned_requirements(path):
for line in path.read_text().splitlines():
one, two = line.split("==", 1)
for line in path.read_text().splitlines(keepends=False):
one, sep, two = line.partition("==")
if not sep:
continue
name = one.strip()
version = two.split("#")[0].strip()
yield name, version
version = two.split("#", 1)[0].strip()
if name and version:
yield name, version

vendor_txt = Path("src/pip/_vendor/vendor.txt")
for name, old_version in pinned_requirements(vendor_txt):
Expand Down

0 comments on commit 3d21ddc

Please sign in to comment.