Tweak how we import pip internal things, for upgrade view

ugh, just kicking the can down the road here
This commit is contained in:
Lance Edgar 2020-01-27 12:57:40 -06:00
parent e9533727db
commit 35875b7826

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar
# Copyright © 2010-2020 Lance Edgar
#
# This file is part of Rattail.
#
@ -35,13 +35,18 @@ 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
# this works for now, with pip 20.0
from pip._internal.network.session 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
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