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

Skip to content

Commit f526b98

Browse files
benjaminwsjtimberman
authored and
jtimberman
committed
Minor fixes in python cookbooks. 'install_path' wouldn't resolve to an actual file, needed an index specified on version.split(). Add in a way to specify which version of python to use when installing distribute (on centos, defaults to 2.4 which virtualenv doesn't work well with).
1 parent 568451e commit f526b98

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

attributes/default.rb

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

21+
# Version of python to use when installing distribute/pip
22+
# default is '', which uses the 'python' binary.
23+
# example value = '2.6' which will use the python2.6 binary
24+
default['python']['base_version'] = ''
25+
2126
default['python']['install_method'] = 'package'
2227

2328
default['python']['url'] = 'http://www.python.org/ftp/python'

recipes/pip.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@
2828
not_if "which pip"
2929
end
3030

31+
base_version = node['python']['base_version']
3132
bash "install-pip" do
3233
cwd Chef::Config[:file_cache_path]
3334
code <<-EOF
34-
python distribute_setup.py
35+
python#{base_version} distribute_setup.py
3536
easy_install pip
3637
EOF
3738
not_if "which pip"

recipes/source.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
end
3333

3434
version = node['python']['version']
35-
install_path = "#{node['python']['prefix_dir']}/lib/python#{version.split(/(^\d+\.\d+)/)}"
35+
install_path = "#{node['python']['prefix_dir']}/lib/python#{version.split(/(^\d+\.\d+)/)[1]}"
3636

3737
remote_file "#{Chef::Config[:file_cache_path]}/Python-#{version}.tar.bz2" do
3838
source "#{node['python']['url']}/#{version}/Python-#{version}.tar.bz2"

0 commit comments

Comments
 (0)