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

Commit e767385

Browse files
committed
source altinstall
1 parent 345c56a commit e767385

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

attributes/default.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
end
3030
else
3131
default['python']['prefix_dir'] = '/usr/local'
32+
default['python']['install_type'] = 'install'
3233
end
3334

3435
default['python']['binary'] = "#{python['prefix_dir']}/bin/python"

recipes/pip.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
if node['python']['install_method'] == 'source'
2727
pip_binary = "#{node['python']['prefix_dir']}/bin/pip"
28+
major_minor_version = node['python']['version'][/\d\.\d/]
2829
elsif platform_family?("rhel")
2930
pip_binary = "/usr/bin/pip"
3031
elsif platform_family?("smartos")
@@ -53,10 +54,28 @@
5354
not_if "#{node['python']['binary']} -c 'import setuptools'"
5455
end
5556

57+
execute "altinstall-setuptools" do
58+
cwd Chef::Config[:file_cache_path]
59+
command <<-EOF
60+
#{node['python']['binary']}#{major_minor_version} ez_setup.py
61+
EOF
62+
not_if "#{node['python']['binary']}-2.7 -c 'import setuptools'"
63+
only_if {node['python']['install_type'] == "altinstall"}
64+
end
65+
5666
execute "install-pip" do
5767
cwd Chef::Config[:file_cache_path]
5868
command <<-EOF
5969
#{node['python']['binary']} get-pip.py
6070
EOF
6171
not_if { ::File.exists?(pip_binary) }
6272
end
73+
74+
execute "altinstall-pip" do
75+
cwd Chef::Config[:file_cache_path]
76+
command <<-EOF
77+
#{node['python']['binary']}#{major_minor_version} get-pip.py
78+
EOF
79+
not_if { ::File.exists?(pip_binary) }
80+
only_if {node['python']['install_type'] == "altinstall"}
81+
end

recipes/source.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
version = node['python']['version']
3535
install_path = "#{node['python']['prefix_dir']}/bin/python#{version.split(/(^\d+\.\d+)/)[1]}"
36+
install_type = node['python']['install_type']
3637

3738
remote_file "#{Chef::Config[:file_cache_path]}/Python-#{version}.tar.bz2" do
3839
source "#{node['python']['url']}/#{version}/Python-#{version}.tar.bz2"
@@ -46,7 +47,7 @@
4647
code <<-EOF
4748
tar -jxvf Python-#{version}.tar.bz2
4849
(cd Python-#{version} && ./configure #{configure_options})
49-
(cd Python-#{version} && make && make install)
50+
(cd Python-#{version} && make && make #{install_type})
5051
EOF
5152
environment({
5253
"LDFLAGS" => "-L#{node['python']['prefix_dir']} -L/usr/lib",

0 commit comments

Comments
 (0)