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

Skip to content

Commit 3663fd7

Browse files
committed
[COOK-2297] more gracefully handle pip packages from VCS or source archives
1 parent 34cb929 commit 3663fd7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

providers/pip.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,14 @@ def candidate_version
131131
end
132132

133133
def install_package(version)
134-
pip_cmd('install', version == 'latest' ? '' : "==#{version}")
134+
# if a version isn't specified (latest), is a source archive (ex. http://my.package.repo/SomePackage-1.0.4.zip),
135+
# or from a VCS (ex. git+https://git.repo/some_pkg.git) then do not append a version as this will break the source link
136+
if version == 'latest' || @new_resource.name.downcase.start_with?('http:') || ['git', 'hg', 'svn'].include?(@new_resource.name.downcase.split('+')[0])
137+
version = ''
138+
else
139+
version = "==#{version}"
140+
end
141+
pip_cmd('install', version)
135142
end
136143

137144
def upgrade_package(version)

0 commit comments

Comments
 (0)