forked from poise/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added recipe to install from source and refactored based on PyCon fee…
…dback.
- Loading branch information
Showing
9 changed files
with
234 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# Author:: Seth Chisamore (<[email protected]>) | ||
# Cookbook Name:: python | ||
# Attribute:: default | ||
# | ||
# Copyright 2011, Opscode, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
default['python']['install_method'] = 'package' | ||
|
||
default['python']['url'] = 'http://www.python.org/ftp/python' | ||
default['python']['version'] = '2.7.1' | ||
default['python']['checksum'] = '80e387bcf57eae8ce26726753584fd63e060ec11682d1145af921e85fd612292' | ||
default['python']['prefix_dir'] = '/usr/local' | ||
|
||
default['python']['configure_options'] = %W{--prefix=#{python['prefix_dir']}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "python", | ||
"description": "Installs python packages. Includes LWRPs for managing `pip` packages and `virtualenv` isolated Python environments.", | ||
"description": "Installs Python, pip and virtualenv. Includes LWRPs for managing Python packages with `pip` and `virtualenv` isolated Python environments.", | ||
"long_description": "", | ||
"maintainer": "Opscode, Inc.", | ||
"maintainer_email": "[email protected]", | ||
|
@@ -23,6 +23,9 @@ | |
] | ||
}, | ||
"dependencies": { | ||
"build-essential": [ | ||
|
||
] | ||
}, | ||
"recommendations": { | ||
}, | ||
|
@@ -39,7 +42,11 @@ | |
"groupings": { | ||
}, | ||
"recipes": { | ||
"python": "Installs python, pip, and virtualenv" | ||
"python": "Installs python, pip, and virtualenv", | ||
"python::package": "Installs python using packages.", | ||
"python::source": "Installs python from source.", | ||
"python::pip": "Installs pip from source.", | ||
"python::virtualenv": "Installs virtualenv using the python_pip resource." | ||
}, | ||
"version": "1.0.1" | ||
"version": "1.0.2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
maintainer "Opscode, Inc." | ||
maintainer_email "[email protected]" | ||
license "Apache 2.0" | ||
description "Installs python packages. Includes LWRPs for managing `pip` packages and `virtualenv` isolated Python environments." | ||
version "1.0.1" | ||
description "Installs Python, pip and virtualenv. Includes LWRPs for managing Python packages with `pip` and `virtualenv` isolated Python environments." | ||
version "1.0.2" | ||
|
||
depends "build-essential" | ||
|
||
recipe "python", "Installs python, pip, and virtualenv" | ||
recipe "python::package", "Installs python using packages." | ||
recipe "python::source", "Installs python from source." | ||
recipe "python::pip", "Installs pip from source." | ||
recipe "python::virtualenv", "Installs virtualenv using the python_pip resource." | ||
|
||
%w{ debian ubuntu centos redhat fedora }.each do |os| | ||
supports os | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# Author:: Seth Chisamore <[email protected]> | ||
# Cookbook Name:: python | ||
# Recipe:: package | ||
# | ||
# Copyright 2011, Opscode, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
python_pkgs = value_for_platform( | ||
["debian","ubuntu"] => { | ||
"default" => ["python","python-dev"] | ||
}, | ||
["centos","redhat","fedora"] => { | ||
"default" => ["python26","python26-devel"] | ||
}, | ||
"default" => ["python","python-dev"] | ||
) | ||
|
||
python_pkgs.each do |pkg| | ||
package pkg do | ||
action :install | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# Author:: Seth Chisamore <[email protected]> | ||
# Cookbook Name:: python | ||
# Recipe:: pip | ||
# | ||
# Copyright 2011, Opscode, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# Ubuntu's python-setuptools, python-pip and python-virtualenv packages | ||
# are broken...this feels like Rubygems! | ||
# http://stackoverflow.com/questions/4324558/whats-the-proper-way-to-install-pip-virtualenv-and-distribute-for-python | ||
# https://bitbucket.org/ianb/pip/issue/104/pip-uninstall-on-ubuntu-linux | ||
remote_file "#{Chef::Config[:file_cache_path]}/distribute_setup.py" do | ||
source "http://python-distribute.org/distribute_setup.py" | ||
mode "0644" | ||
not_if "which pip" | ||
end | ||
|
||
bash "install-pip" do | ||
cwd Chef::Config[:file_cache_path] | ||
code <<-EOF | ||
python distribute_setup.py | ||
easy_install pip | ||
EOF | ||
not_if "which pip" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# | ||
# Author:: Seth Chisamore <[email protected]> | ||
# Cookbook Name:: python | ||
# Recipe:: source | ||
# | ||
# Copyright 2011, Opscode, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
configure_options = node['python']['configure_options'].join(" ") | ||
|
||
packages = value_for_platform( | ||
["centos","redhat","fedora"] => | ||
{"default" => ["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.each do |dev_pkg| | ||
package dev_pkg | ||
end | ||
|
||
version = node['python']['version'] | ||
install_path = "#{node['python']['prefix_dir']}/lib/python#{version.split(/(^\d+\.\d+)/)}" | ||
|
||
remote_file "#{Chef::Config[:file_cache_path]}/Python-#{version}.tar.bz2" do | ||
source "#{node['python']['url']}/#{version}/Python-#{version}.tar.bz2" | ||
checksum node['python']['checksum'] | ||
mode "0644" | ||
not_if { ::File.exists?(install_path) } | ||
end | ||
|
||
bash "build-and-install-python" do | ||
cwd Chef::Config[:file_cache_path] | ||
code <<-EOF | ||
tar -jxvf Python-#{version}.tar.bz2 | ||
(cd Python-#{version} && ./configure #{configure_options}) | ||
(cd Python-#{version} && make && make install) | ||
EOF | ||
not_if { ::File.exists?(install_path) } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# | ||
# Author:: Seth Chisamore <[email protected]> | ||
# Cookbook Name:: python | ||
# Recipe:: virtualenv | ||
# | ||
# Copyright 2011, Opscode, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
include_recipe "python::pip" | ||
|
||
python_pip "virtualenv" do | ||
action :install | ||
end |