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

Skip to content
This repository was archived by the owner on Oct 2, 2018. It is now read-only.

[COOK-2297] more gracefully handle pip packages from VCS and source archives #28

Merged
merged 1 commit into from
Feb 2, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion providers/pip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,14 @@ def candidate_version
end

def install_package(version)
pip_cmd('install', version == 'latest' ? '' : "==#{version}")
# if a version isn't specified (latest), is a source archive (ex. http://my.package.repo/SomePackage-1.0.4.zip),
# 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
if version == 'latest' || @new_resource.name.downcase.start_with?('http:') || ['git', 'hg', 'svn'].include?(@new_resource.name.downcase.split('+')[0])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't take HTTPS into account.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're correct, I failed to take that into account. Perhaps a single regex test would be better? I'm not sure of the proper way to update this, though. Update the associated ticket and this pull request or submit a new ticket and pull request?

version = ''
else
version = "==#{version}"
end
pip_cmd('install', version)
end

def upgrade_package(version)
Expand Down