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.

added version checking to virtualenv install not_if statement #75

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 6 additions & 2 deletions recipes/pip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
cookbook_file "#{Chef::Config[:file_cache_path]}/ez_setup.py" do
source 'ez_setup.py'
mode "0644"
not_if "#{node['python']['binary']} -c 'import setuptools'"
not_if "#{node['python']['binary']} -c 'import pkg_resources, sys;\
sys.exit(1) if float(pkg_resources.get_distribution(\"setuptools\")\
.version[:3]) < 0.8 else sys.exit(0)'"
end

cookbook_file "#{Chef::Config[:file_cache_path]}/get-pip.py" do
Expand All @@ -50,7 +52,9 @@
command <<-EOF
#{node['python']['binary']} ez_setup.py
EOF
not_if "#{node['python']['binary']} -c 'import setuptools'"
not_if "#{node['python']['binary']} -c 'import pkg_resources, sys;\
sys.exit(1) if float(pkg_resources.get_distribution(\"setuptools\")\
.version[:3]) < 0.8 else sys.exit(0)'"
end

execute "install-pip" do
Expand Down