Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 45f46ae

Browse files
committed
support pip19
1 parent 7e5dde2 commit 45f46ae

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

files/halite_gem/poise_python/resources/python_package.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ module PythonPackage
5050
# Pip 10 moved all internals to their own package.
5151
from pip._internal.commands import InstallCommand
5252
from pip._internal.index import PackageFinder
53-
from pip._internal.req import InstallRequirement
54-
from pip._internal.req.constructors import install_req_from_line
53+
5554
5655
packages = {}
5756
cmd = InstallCommand()
@@ -75,7 +74,12 @@ module PythonPackage
7574
finder = PackageFinder(**finder_options)
7675
find_all = getattr(finder, 'find_all_candidates', getattr(finder, '_find_all_versions', None))
7776
for arg in args:
78-
req = install_req_from_line(arg)
77+
try:
78+
from pip._internal.req.constructors import install_req_from_line
79+
req = install_req_from_line(arg)
80+
except ImportError:
81+
from pip._internal.req import InstallRequirement
82+
req = InstallRequirement.from_line(arg)
7983
found = finder.find_requirement(req, True)
8084
all_candidates = find_all(req.name)
8185
candidate = [c for c in all_candidates if c.location == found]

files/halite_gem/poise_python/resources/python_runtime_pip.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ def install_pip
180180
end
181181

182182
Chef::Log.debug("[#{new_resource}] Installing pip #{new_resource.version} via itself")
183+
if pip_version.to_i < 19
184+
get_pip_url = 'https://s3.amazonaws.com/a1s-public-software-repository/get-pip.py'
185+
end
183186
notifying_block do
184187
# Use pip to upgrade (or downgrade) itself.
185188
python_package 'pip' do

0 commit comments

Comments
 (0)