tools: update lint.py to work with pip 10+ some more (#2273)

main() and InstallRequirement were also removed from the public API.
This commit is contained in:
Ms2ger 2019-08-08 20:11:34 +02:00 committed by Leo Balter
parent 00ef6331a6
commit 8f5f6a1aa1
1 changed files with 6 additions and 5 deletions

View File

@ -5,11 +5,12 @@
import argparse
import inflect
import os
import pip
try:
from pip._internal.req import parse_requirements
from pip._internal import main as pip
from pip._internal.req import parse_requirements, InstallRequirement
except ImportError:
from pip.req import parse_requirements
from pip import main as pip
from pip.req import parse_requirements, InstallRequirement
import sys
ie = inflect.engine()
@ -18,14 +19,14 @@ try:
__import__('yaml')
except ImportError:
for item in parse_requirements("./tools/lint/requirements.txt", session="test262"):
if isinstance(item, pip.req.InstallRequirement):
if isinstance(item, InstallRequirement):
requirement = item.name
if len(str(item.req.specifier)) > 0:
requirement = "{}{}".format(requirement, item.req.specifier)
# print(requirement)
pip.main(['install', requirement])
pip(['install', requirement])
from lib.collect_files import collect_files