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,10 +31,18 @@ import re
import logging
import six
from pip.download import PipSession
from pip.req import parse_requirements
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.req import parse_requirements
from rattail.db import model, Session as RattailSession
from rattail.time import make_utc
from rattail.threads import Thread