scripts: Handle lines with == in marker correctly

This commit is contained in:
Florian Bruhin 2021-12-20 11:36:26 +01:00
parent 00b0ef3c1f
commit 6b66221dea
1 changed files with 7 additions and 7 deletions

View File

@ -392,14 +392,14 @@ def _get_changed_files():
def parse_versioned_line(line):
"""Parse a requirements.txt line into name/version."""
if line[0] == '#': # ignored dependency
line = line[1:].strip()
# Strip comments and pip environment markers
line = line.rsplit('#', maxsplit=1)[0]
line = line.split(';')[0].strip()
if '==' in line:
if line[0] == '#': # ignored dependency
line = line[1:].strip()
# Strip comments and pip environment markers
line = line.rsplit('#', maxsplit=1)[0]
line = line.split(';')[0].strip()
name, version = line.split('==')
elif line.startswith('-e'):
rest, name = line.split('#egg=')