From 35875b7826b35b79eab45ffd02362a437ed1f0fd Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 27 Jan 2020 12:57:40 -0600 Subject: [PATCH] Tweak how we import pip internal things, for upgrade view ugh, just kicking the can down the road here --- tailbone/views/upgrades.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tailbone/views/upgrades.py b/tailbone/views/upgrades.py index 8c7b1216..2a37709b 100644 --- a/tailbone/views/upgrades.py +++ b/tailbone/views/upgrades.py @@ -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