Automatically fix package=version in requirements.txt

This commit is contained in:
Paul Hooijenga 2018-10-23 21:26:37 +02:00
parent 86bfe8c475
commit f8b8997c07
2 changed files with 4 additions and 0 deletions

View file

@ -61,6 +61,9 @@ def fix_requirements(f):
elif line.startswith(b'#') or line.strip() == b'':
requirement.comments.append(line)
else:
# Automatically fix 'package=version' to 'package==version'
if b'=' in line and b'==' not in line and b'egg=' not in line:
line = line.replace(b'=', b'==')
requirement.value = line
# if a file ends in a comment, preserve it at the end