From 7e6140e0b738bf91d514c06a6da858fba7152427 Mon Sep 17 00:00:00 2001 From: Tom Duckering Date: Mon, 30 Sep 2013 17:54:17 +0100 Subject: [PATCH] tom/susie - allowing install of python etc from specified urls so that we can install in locked down environments. --- metadata.rb | 2 +- recipes/pip.rb | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/metadata.rb b/metadata.rb index 8128d6d..f45fef3 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,7 +3,7 @@ maintainer_email "cookbooks@opscode.com" license "Apache 2.0" description "Installs Python, pip and virtualenv. Includes LWRPs for managing Python packages with `pip` and `virtualenv` isolated Python environments." -version "1.4.1" +version "1.4.2" depends "build-essential" depends "yum" diff --git a/recipes/pip.rb b/recipes/pip.rb index 65acfa7..e4abc72 100644 --- a/recipes/pip.rb +++ b/recipes/pip.rb @@ -45,10 +45,16 @@ not_if { ::File.exists?(pip_binary) } end +download_base_option = if node['python']['setuptools_download_base'] + "--download-base #{node['python']['setuptools_download_base']}" + else + "" + end + execute "install-setuptools" do cwd Chef::Config[:file_cache_path] command <<-EOF - #{node['python']['binary']} ez_setup.py + #{node['python']['binary']} ez_setup.py #{download_base_option} EOF not_if "#{node['python']['binary']} -c 'import setuptools'" end @@ -58,5 +64,13 @@ command <<-EOF #{node['python']['binary']} get-pip.py EOF - not_if { ::File.exists?(pip_binary) } + not_if { ::File.exists?(pip_binary) || node['python']['pip_package_url'] } +end + +execute "install-pip from URL" do + cwd Chef::Config[:file_cache_path] + command <<-EOF +easy_install #{node['python']['pip_package_url']} + EOF + only_if { ! ::File.exists?(pip_binary) && node['python']['pip_package_url'] } end