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

Skip to content

Commit 3b087b8

Browse files
committed
[COOK-1169] Separated Python and pip's prefix_dir so that the installation of pip can complete when install_method is "package."
1 parent a5cce1a commit 3b087b8

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

attributes/default.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,16 @@
1919
#
2020

2121
default['python']['install_method'] = 'package'
22-
default['python']['prefix_dir'] = '/usr/local'
22+
23+
if python['install_method'] == 'package'
24+
default['python']['prefix_dir'] = '/usr'
25+
else
26+
default['python']['prefix_dir'] = '/usr/local'
27+
end
28+
2329
default['python']['url'] = 'http://www.python.org/ftp/python'
2430
default['python']['version'] = '2.7.1'
2531
default['python']['checksum'] = '80e387bcf57eae8ce26726753584fd63e060ec11682d1145af921e85fd612292'
2632
default['python']['configure_options'] = %W{--prefix=#{python['prefix_dir']}}
33+
34+
default['python']['pip']['prefix_dir'] = '/usr/local'

recipes/pip.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
# limitations under the License.
1919
#
2020

21-
python_bindir = "#{node['python']['prefix_dir']}/bin/"
21+
python_bindir = "#{node['python']['prefix_dir']}/bin"
22+
pip_bindir = "#{node['python']['pip']['prefix_dir']}/bin"
2223

2324
# Ubuntu's python-setuptools, python-pip and python-virtualenv packages
2425
# are broken...this feels like Rubygems!
@@ -27,14 +28,14 @@
2728
remote_file "#{Chef::Config[:file_cache_path]}/distribute_setup.py" do
2829
source "http://python-distribute.org/distribute_setup.py"
2930
mode "0644"
30-
not_if { ::File.exists?(python_bindir+'pip') }
31+
not_if { ::File.exists?("#{pip_bindir}/pip") }
3132
end
3233

3334
bash "install-pip" do
3435
cwd Chef::Config[:file_cache_path]
3536
code <<-EOF
36-
#{python_bindir}python distribute_setup.py
37-
#{python_bindir}easy_install pip
37+
#{python_bindir}/python distribute_setup.py
38+
#{pip_bindir}/easy_install pip
3839
EOF
39-
not_if { ::File.exists?(python_bindir+'pip') }
40+
not_if { ::File.exists?("#{pip_bindir}/pip") }
4041
end

0 commit comments

Comments
 (0)