PageRenderTime 50ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 1ms

/chef-oulima/cookbooks/python/recipes/pip.rb

https://bitbucket.org/slashmili/oulima-vagrant
Ruby | 44 lines | 16 code | 3 blank | 25 comment | 1 complexity | a32a1d948c4ec28bc5fb5f1e88b7982b MD5 | raw file
Possible License(s): Apache-2.0
  1. #
  2. # Author:: Seth Chisamore <schisamo@opscode.com>
  3. # Cookbook Name:: python
  4. # Recipe:: pip
  5. #
  6. # Copyright 2011, Opscode, Inc.
  7. #
  8. # Licensed under the Apache License, Version 2.0 (the "License");
  9. # you may not use this file except in compliance with the License.
  10. # You may obtain a copy of the License at
  11. #
  12. # http://www.apache.org/licenses/LICENSE-2.0
  13. #
  14. # Unless required by applicable law or agreed to in writing, software
  15. # distributed under the License is distributed on an "AS IS" BASIS,
  16. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. # See the License for the specific language governing permissions and
  18. # limitations under the License.
  19. #
  20. if platform_family?("rhel")
  21. pip_binary = "/usr/bin/pip"
  22. else
  23. pip_binary = "/usr/local/bin/pip"
  24. end
  25. # Ubuntu's python-setuptools, python-pip and python-virtualenv packages
  26. # are broken...this feels like Rubygems!
  27. # http://stackoverflow.com/questions/4324558/whats-the-proper-way-to-install-pip-virtualenv-and-distribute-for-python
  28. # https://bitbucket.org/ianb/pip/issue/104/pip-uninstall-on-ubuntu-linux
  29. remote_file "#{Chef::Config[:file_cache_path]}/distribute_setup.py" do
  30. source "http://python-distribute.org/distribute_setup.py"
  31. mode "0644"
  32. not_if { ::File.exists?(pip_binary) }
  33. end
  34. execute "install-pip" do
  35. cwd Chef::Config[:file_cache_path]
  36. command <<-EOF
  37. #{node['python']['binary']} distribute_setup.py
  38. #{::File.dirname(pip_binary)}/easy_install pip
  39. EOF
  40. not_if { ::File.exists?(pip_binary) }
  41. end