Add workaround for using pip 10.0 "internal" API in upgrades view

This commit is contained in:
Lance Edgar 2018-06-14 19:57:15 -05:00
parent 93b3a5dab6
commit 8387129eda

View file

@ -31,9 +31,17 @@ import re
import logging import logging
import six import six
from sqlalchemy import orm
# TODO: pip has declared these to be "not public API" so we should find another way..
try:
# this works for now, with pip 10.0.1
from pip._internal.download import PipSession
from pip._internal.req import parse_requirements
except ImportError:
# this should work with pip < 10.0
from pip.download import PipSession from pip.download import PipSession
from pip.req import parse_requirements from pip.req import parse_requirements
from sqlalchemy import orm
from rattail.db import model, Session as RattailSession from rattail.db import model, Session as RattailSession
from rattail.time import make_utc from rattail.time import make_utc