From 8387129eda4a1a051711145048061355910d9817 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 14 Jun 2018 19:57:15 -0500 Subject: [PATCH] Add workaround for using pip 10.0 "internal" API in upgrades view --- tailbone/views/upgrades.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tailbone/views/upgrades.py b/tailbone/views/upgrades.py index e20ba05e..bf59711f 100644 --- a/tailbone/views/upgrades.py +++ b/tailbone/views/upgrades.py @@ -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