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

Commit a18893e

Browse files
author
Eugene Alekseev
committed
Do install pip and setuptools via apt on debian and ubuntu.
1 parent d13e97c commit a18893e

1 file changed

Lines changed: 31 additions & 23 deletions

File tree

‎recipes/pip.rb‎

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,39 @@
2323
# redhat/package: /usr/bin/pip (sha a8a3a3)
2424
# omnibus/source: /opt/local/bin/pip (sha 29ce9874)
2525

26-
if node['python']['install_method'] == 'source'
27-
pip_binary = "#{node['python']['prefix_dir']}/bin/pip"
28-
elsif platform_family?("rhel", "fedora")
29-
pip_binary = "/usr/bin/pip"
30-
elsif platform_family?("smartos")
31-
pip_binary = "/opt/local/bin/pip"
26+
if platform_family?("debian")
27+
package 'python-pip'
28+
package 'python-setuptools' do
29+
action :upgrade
30+
version node['python']['setuptools_version']
31+
end
3232
else
33-
pip_binary = "/usr/local/bin/pip"
34-
end
33+
if node['python']['install_method'] == 'source'
34+
pip_binary = "#{node['python']['prefix_dir']}/bin/pip"
35+
elsif platform_family?("rhel", "fedora")
36+
pip_binary = "/usr/bin/pip"
37+
elsif platform_family?("smartos")
38+
pip_binary = "/opt/local/bin/pip"
39+
else
40+
pip_binary = "/usr/local/bin/pip"
41+
end
3542

36-
cookbook_file "#{Chef::Config[:file_cache_path]}/get-pip.py" do
37-
source 'get-pip.py'
38-
mode "0644"
39-
not_if { ::File.exists?(pip_binary) }
40-
end
43+
cookbook_file "#{Chef::Config[:file_cache_path]}/get-pip.py" do
44+
source 'get-pip.py'
45+
mode "0644"
46+
not_if { ::File.exists?(pip_binary) }
47+
end
4148

42-
execute "install-pip" do
43-
cwd Chef::Config[:file_cache_path]
44-
command <<-EOF
45-
#{node['python']['binary']} get-pip.py
46-
EOF
47-
not_if { ::File.exists?(pip_binary) }
48-
end
49+
execute "install-pip" do
50+
cwd Chef::Config[:file_cache_path]
51+
command <<-EOF
52+
#{node['python']['binary']} get-pip.py
53+
EOF
54+
not_if { ::File.exists?(pip_binary) }
55+
end
4956

50-
python_pip 'setuptools' do
51-
action :upgrade
52-
version node['python']['setuptools_version']
57+
python_pip 'setuptools' do
58+
action :upgrade
59+
version node['python']['setuptools_version']
60+
end
5361
end

0 commit comments

Comments
 (0)