Skip to content

Commit

Permalink
Fix pip import path in 19.3
Browse files Browse the repository at this point in the history
This patch was provided by hgibsonqb
#1272 (comment)
  • Loading branch information
stealthycoin committed Oct 15, 2019
1 parent 2636a2d commit 8ce938c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions chalice/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ def pip_import_string():
# type: () -> str
import pip
pip_major_version = pip.__version__.split('.')[0]
pip_minor_version = pip.__version__.split('.')[1]
# Pip moved its internals to an _internal module in version 10.
# In order to be compatible with version 9 which has it at at the
# top level we need to figure out the correct import path here.
if pip_major_version == '9':
return 'from pip import main'
# Pip changed their import structure again in 19.3
# https://github.com/pypa/pip/commit/09fd200
elif pip_major_version == '19' and int(pip_minor_version) >= '3':
return 'from pip._internal.main import main'
else:
return 'from pip._internal import main'

Expand Down

0 comments on commit 8ce938c

Please sign in to comment.