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

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

[COOK-1016] Adds better package name handling for python2.6 between dist... #3

Merged
merged 1 commit into from
May 23, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
==========
Expand Down
14 changes: 11 additions & 3 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@
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'
default['python']['version'] = '2.7.1'
default['python']['checksum'] = '80e387bcf57eae8ce26726753584fd63e060ec11682d1145af921e85fd612292'
default['python']['configure_options'] = %W{--prefix=#{python['prefix_dir']}}

default['python']['pip']['prefix_dir'] = '/usr/local'
1 change: 1 addition & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
45 changes: 32 additions & 13 deletions recipes/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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