diff --git a/recipes/package.rb b/recipes/package.rb index 3ccb688..c501184 100644 --- a/recipes/package.rb +++ b/recipes/package.rb @@ -22,22 +22,30 @@ # COOK-1016 Handle RHEL/CentOS namings of python packages, by installing EPEL # repo & package -if platform_family?('rhel') && major_version < 6 +if node['platform_family'] == 'rhel' && node['platform_version'].to_i < 6 include_recipe 'yum::epel' python_pkgs = ["python26", "python26-devel"] node.set['python']['binary'] = "/usr/bin/python26" else - python_pkgs = value_for_platform_family( - "debian" => ["python","python-dev"], - "rhel" => ["python","python-devel"], - "freebsd" => ["python"], - "smartos" => ["python27"], - "default" => ["python","python-dev"] + python_pkgs = value_for_platform( + ["debian"] => {"default" => ["python","python-dev"]}, + ["rhel"] => {"default" => ["python","python-devel"]}, + ["freebsd"] => {"default" => ["python"]}, + ["smartos"] => {"default" => ["python27"]}, + "default" => {"default" => ["python","python-dev"]} ) end python_pkgs.each do |pkg| - package pkg do - action :install + unless pkg.is_a?(String) + pkg.last.each do |p| + package p do + action :install + end + end + else + package pkg do + action :install + end end end diff --git a/recipes/pip.rb b/recipes/pip.rb index ca2151e..a4d4b70 100644 --- a/recipes/pip.rb +++ b/recipes/pip.rb @@ -18,9 +18,9 @@ # limitations under the License. # -if platform_family?("rhel") and node['python']['install_method'] == 'package' +if node['platform_family'] == "rhel" and node['python']['install_method'] == 'package' pip_binary = "/usr/bin/pip" -elsif platform_family?("smartos") +elsif node['platform_family'] == "smartos" pip_binary = "/opt/local/bin/pip" else pip_binary = "/usr/local/bin/pip" diff --git a/recipes/source.rb b/recipes/source.rb index 7665010..48a3dbf 100644 --- a/recipes/source.rb +++ b/recipes/source.rb @@ -20,9 +20,9 @@ configure_options = node['python']['configure_options'].join(" ") -packages = value_for_platform_family( - "rhel" => ["openssl-devel","bzip2-devel","zlib-devel","expat-devel","db4-devel","sqlite-devel","ncurses-devel","readline-devel"], - "default" => ["libssl-dev","libbz2-dev","zlib1g-dev","libexpat1-dev","libdb4.8-dev","libsqlite3-dev","libncursesw5-dev","libncurses5-dev","libreadline-dev"] +packages = value_for_platform( + ["rhel"] => {"default" => ["openssl-devel","bzip2-devel","zlib-devel","expat-devel","db4-devel","sqlite-devel","ncurses-devel","readline-devel"] }, + "default" => {"default" => ["libssl-dev","libbz2-dev","zlib1g-dev","libexpat1-dev","libdb4.8-dev","libsqlite3-dev","libncursesw5-dev","libncurses5-dev","libreadline-dev"]} ) packages.each do |dev_pkg|