From a18893e12e9e0d63c4e120122c521f3a1cfdf2c6 Mon Sep 17 00:00:00 2001 From: Eugene Alekseev Date: Thu, 11 Sep 2014 11:53:22 +0400 Subject: [PATCH 1/2] Do install pip and setuptools via apt on debian and ubuntu. --- recipes/pip.rb | 54 +++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/recipes/pip.rb b/recipes/pip.rb index 17110fa..8119cde 100644 --- a/recipes/pip.rb +++ b/recipes/pip.rb @@ -23,31 +23,39 @@ # redhat/package: /usr/bin/pip (sha a8a3a3) # omnibus/source: /opt/local/bin/pip (sha 29ce9874) -if node['python']['install_method'] == 'source' - pip_binary = "#{node['python']['prefix_dir']}/bin/pip" -elsif platform_family?("rhel", "fedora") - pip_binary = "/usr/bin/pip" -elsif platform_family?("smartos") - pip_binary = "/opt/local/bin/pip" +if platform_family?("debian") + package 'python-pip' + package 'python-setuptools' do + action :upgrade + version node['python']['setuptools_version'] + end else - pip_binary = "/usr/local/bin/pip" -end + if node['python']['install_method'] == 'source' + pip_binary = "#{node['python']['prefix_dir']}/bin/pip" + elsif platform_family?("rhel", "fedora") + pip_binary = "/usr/bin/pip" + elsif platform_family?("smartos") + pip_binary = "/opt/local/bin/pip" + else + pip_binary = "/usr/local/bin/pip" + end -cookbook_file "#{Chef::Config[:file_cache_path]}/get-pip.py" do - source 'get-pip.py' - mode "0644" - not_if { ::File.exists?(pip_binary) } -end + cookbook_file "#{Chef::Config[:file_cache_path]}/get-pip.py" do + source 'get-pip.py' + mode "0644" + not_if { ::File.exists?(pip_binary) } + end -execute "install-pip" do - cwd Chef::Config[:file_cache_path] - command <<-EOF - #{node['python']['binary']} get-pip.py - EOF - not_if { ::File.exists?(pip_binary) } -end + execute "install-pip" do + cwd Chef::Config[:file_cache_path] + command <<-EOF + #{node['python']['binary']} get-pip.py + EOF + not_if { ::File.exists?(pip_binary) } + end -python_pip 'setuptools' do - action :upgrade - version node['python']['setuptools_version'] + python_pip 'setuptools' do + action :upgrade + version node['python']['setuptools_version'] + end end From 25803531ad93b8ffe3e66b1c1b41a6c88b22d191 Mon Sep 17 00:00:00 2001 From: Eugene Alekseev Date: Thu, 11 Sep 2014 12:44:25 +0400 Subject: [PATCH 2/2] Do install virtualenv via apt on debian and ubuntu. --- recipes/virtualenv.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/recipes/virtualenv.rb b/recipes/virtualenv.rb index 8098492..0173e36 100644 --- a/recipes/virtualenv.rb +++ b/recipes/virtualenv.rb @@ -20,7 +20,14 @@ include_recipe "python::pip" -python_pip "virtualenv" do - action :upgrade - version node['python']['virtualenv_version'] +if platform_family?("debian") + package "python-virtualenv" do + action :upgrade + version node['python']['virtualenv_version'] + end +else + python_pip "virtualenv" do + action :upgrade + version node['python']['virtualenv_version'] + end end