|
33 | 33 | pip_binary = "/usr/local/bin/pip" |
34 | 34 | end |
35 | 35 |
|
36 | | -# Ubuntu's python-setuptools, python-pip and python-virtualenv packages |
37 | | -# are broken...this feels like Rubygems! |
38 | | -# http://stackoverflow.com/questions/4324558/whats-the-proper-way-to-install-pip-virtualenv-and-distribute-for-python |
39 | | -# https://bitbucket.org/ianb/pip/issue/104/pip-uninstall-on-ubuntu-linux |
40 | | -remote_file "#{Chef::Config[:file_cache_path]}/distribute_setup.py" do |
41 | | - source node['python']['distribute_script_url'] |
| 36 | +if node['python']['install_method'] == 'source' |
| 37 | + ez_binary = "#{node['python']['prefix_dir']}/bin/easy_install" |
| 38 | +elsif platform_family?("rhel") |
| 39 | + ez_binary = "/usr/bin/easy_install" |
| 40 | +elsif platform_family?("smartos") |
| 41 | + ez_binary = "/opt/local/bin/easy_install" |
| 42 | +else |
| 43 | + ez_binary = "/usr/local/bin/easy_install" |
| 44 | +end |
| 45 | + |
| 46 | +remote_file "#{Chef::Config[:file_cache_path]}/ez_setup.py" do |
| 47 | + source node['python']['setuptools_script_url'] |
| 48 | + mode "0644" |
| 49 | + not_if { ::File.exists?(ez_binary) } |
| 50 | +end |
| 51 | + |
| 52 | +remote_file "#{Chef::Config[:file_cache_path]}/get-pip.py" do |
| 53 | + source node['python']['pip_script_url'] |
42 | 54 | mode "0644" |
43 | 55 | not_if { ::File.exists?(pip_binary) } |
44 | 56 | end |
45 | 57 |
|
| 58 | +execute "install-setuptools" do |
| 59 | + cwd Chef::Config[:file_cache_path] |
| 60 | + command <<-EOF |
| 61 | + #{node['python']['binary']} ez_setup.py |
| 62 | + EOF |
| 63 | + not_if { ::File.exists?(ez_binary) } |
| 64 | +end |
| 65 | + |
46 | 66 | execute "install-pip" do |
47 | 67 | cwd Chef::Config[:file_cache_path] |
48 | 68 | command <<-EOF |
49 | | - #{node['python']['binary']} distribute_setup.py --download-base=#{node['python']['distribute_option']['download_base']} |
50 | | - #{::File.dirname(pip_binary)}/easy_install pip |
| 69 | + #{node['python']['binary']} get-pip.py |
51 | 70 | EOF |
52 | 71 | not_if { ::File.exists?(pip_binary) } |
53 | 72 | end |
0 commit comments