tools: update lint.py to work with pip 10+

Update the lint.py script to work with pip 10+ as pip.req was moved to
pip._internal.req in version 10 onwards and the existing code only works
on versions of pip under or equal to 9.0.3
This commit is contained in:
Ujjwal Sharma 2018-09-16 21:13:36 +05:30 committed by Rick Waldron
parent fd4a46a657
commit fbd79b10a7
1 changed files with 5 additions and 2 deletions

View File

@ -6,7 +6,10 @@ import argparse
import inflect import inflect
import os import os
import pip import pip
import pip.req try:
from pip._internal.req import parse_requirements
except ImportError:
from pip.req import parse_requirements
import sys import sys
ie = inflect.engine() ie = inflect.engine()
@ -14,7 +17,7 @@ ie = inflect.engine()
try: try:
__import__('yaml') __import__('yaml')
except ImportError: except ImportError:
for item in pip.req.parse_requirements("./tools/lint/requirements.txt", session="test262"): for item in parse_requirements("./tools/lint/requirements.txt", session="test262"):
if isinstance(item, pip.req.InstallRequirement): if isinstance(item, pip.req.InstallRequirement):
requirement = item.name requirement = item.name