From 784150eaa3bdae7d7444acf6d8cee490bc56817d Mon Sep 17 00:00:00 2001 From: mohitsethi Date: Tue, 29 Oct 2013 14:20:49 +0530 Subject: [PATCH] Create pip.conf when using local pypi mirror --- attributes/default.rb | 6 ++++-- recipes/pip.rb | 9 +++++++++ templates/default/pip.conf.erb | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 templates/default/pip.conf.erb diff --git a/attributes/default.rb b/attributes/default.rb index d0a32c4..b88c345 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -39,7 +39,9 @@ default['python']['configure_options'] = %W{--prefix=#{python['prefix_dir']}} default['python']['make_options'] = %W{install} +default['python']['setuptools_script_url'] = 'https://bitbucket.org/pypa/setuptools/raw/0.8/ez_setup.py' +default['python']['pip_script_url'] = 'https://raw.github.com/pypa/pip/master/contrib/get-pip.py' default['python']['pip_location'] = "#{node['python']['prefix_dir']}/bin/pip" default['python']['virtualenv_location'] = "#{node['python']['prefix_dir']}/bin/virtualenv" -default['python']['setuptools_version'] = nil # defaults to latest -default['python']['virtualenv_version'] = nil +default['python']['pypi_mirror'] = "" +default['python']['pip_conf']['system_loc'] = "/root/.pip/pip.conf" \ No newline at end of file diff --git a/recipes/pip.rb b/recipes/pip.rb index 17110fa..5306b1e 100644 --- a/recipes/pip.rb +++ b/recipes/pip.rb @@ -23,6 +23,15 @@ # redhat/package: /usr/bin/pip (sha a8a3a3) # omnibus/source: /opt/local/bin/pip (sha 29ce9874) +if not node['python']['pypi_mirror'].empty? + template "#{node['python']['pip_conf']['system_loc']}" do + source "pip.conf.erb" + mode "644" + owner "root" + group "root" + end +end + if node['python']['install_method'] == 'source' pip_binary = "#{node['python']['prefix_dir']}/bin/pip" elsif platform_family?("rhel", "fedora") diff --git a/templates/default/pip.conf.erb b/templates/default/pip.conf.erb new file mode 100644 index 0000000..013b585 --- /dev/null +++ b/templates/default/pip.conf.erb @@ -0,0 +1,3 @@ +[global] +index-url = <%= node['python']['pypi_mirror'] %> + \ No newline at end of file