diff --git a/README.md b/README.md index 7af44ae..31dece8 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ Cookbooks --------- * build-essential +* yum + +NOTE: The `yum` cookbook is a dependency of the cookbook, and will be used to install [EPEL](http://fedoraproject.org/wiki/EPEL) on RedHet/CentOS 5.x systems to provide the Python 2.6 packages. Attributes ========== diff --git a/attributes/default.rb b/attributes/default.rb index e0a9e96..794d873 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -21,9 +21,18 @@ default['python']['install_method'] = 'package' if python['install_method'] == 'package' - default['python']['prefix_dir'] = '/usr' + default['python']['prefix_dir'] = '/usr' else - default['python']['prefix_dir'] = '/usr/local' + default['python']['prefix_dir'] = '/usr/local' +end + +case platform +when "redhat","centos","scientific","fedora","suse","amazon" + set['python']['pip']['prefix_dir'] = '/usr' +when "debian","ubuntu" + set['python']['pip']['prefix_dir'] = '/usr/local' +else + set['python']['pip']['prefix_dir'] = '/usr/local' end default['python']['url'] = 'http://www.python.org/ftp/python' @@ -31,4 +40,3 @@ default['python']['checksum'] = '80e387bcf57eae8ce26726753584fd63e060ec11682d1145af921e85fd612292' default['python']['configure_options'] = %W{--prefix=#{python['prefix_dir']}} -default['python']['pip']['prefix_dir'] = '/usr/local' diff --git a/metadata.rb b/metadata.rb index f57f356..2071ec4 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,6 +5,7 @@ version "1.0.6" depends "build-essential" +depends "yum" recipe "python", "Installs python, pip, and virtualenv" recipe "python::package", "Installs python using packages." diff --git a/recipes/package.rb b/recipes/package.rb index 5a44da3..95dcce0 100644 --- a/recipes/package.rb +++ b/recipes/package.rb @@ -18,22 +18,41 @@ # limitations under the License. # -python_pkgs = value_for_platform( - ["debian","ubuntu"] => { - "default" => ["python","python-dev"] - }, - ["centos","redhat","fedora"] => { - "default" => ["python26","python26-devel"] - }, - ["freebsd"] => { - "default" => ["python"] - }, - "default" => ["python","python-dev"] -) +# COOK-1016 Handle RHEL/CentOS namings of python packages, by installing EPEL repo & package +# This implementation was determined a stopgap measure until CHEF-2410 is implemented and widespread. +if node['platform'] == 'centos' || node['platform'] == 'redhat' + major_version = node['platform_version'].split('.').first.to_i + if major_version == 5 + include_recipe 'yum::epel' + else + # Do nothing. + end +end + +python_pkgs = if node['platform'] == 'centos' || node['platform'] == 'redhat' + major_version = node['platform_version'].split('.').first.to_i + if major_version == 6 + ["python", "python-devel"] + else + ["python26", "python26-devel"] + end + else + value_for_platform( + ["debian","ubuntu"] => { + "default" => ["python","python-dev"] + }, + ["fedora","amazon"] => { + "default" => ["python","python-devel"] + }, + ["freebsd"] => { + "default" => ["python"] + }, + "default" => ["python","python-dev"] + ) + end python_pkgs.each do |pkg| package pkg do action :install end end -