Skip to content

Commit

Permalink
Allow selectors and '@' index selection
Browse files Browse the repository at this point in the history
Also, trim `-e` from start but otherwise allow it
  • Loading branch information
bcaller committed Feb 23, 2024
1 parent b843041 commit 24b4456
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions assets/pip-audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,12 @@ def install_commands(lock_path: str) -> Iterator[tuple[list[str], int]]:
while line.endswith("\\"):
zero_indexed_lineno += 1
line = line[:-1].strip() + " " + lock_file_lines[zero_indexed_lineno]
# There could be quoted or escaped spaces, but unlikely in 1st word.
install_cmd = [line.strip().split(" ", 1)[0]]
yield (install_cmd, zero_indexed_lineno + 1)
# There could be quoted or escaped spaces, but unlikely to be affected.
# Ignore --hash= and anything commented out but allow @ and ;sys_platform
install_cmd = line.strip().split("#", 1)[0].split(" --", 1)[0].strip()
if install_cmd.startswith("-e "):
install_cmd = install_cmd[3:].strip()
yield ([install_cmd], zero_indexed_lineno + 1)
zero_indexed_lineno += 1

if __name__ == "__main__":
Expand Down

0 comments on commit 24b4456

Please sign in to comment.