diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/ansible.rb | 56 |
1 files changed, 17 insertions, 39 deletions
diff --git a/Library/Formula/ansible.rb b/Library/Formula/ansible.rb index 83fdfddc7..a1fb2775a 100644 --- a/Library/Formula/ansible.rb +++ b/Library/Formula/ansible.rb @@ -44,54 +44,32 @@ class Ansible < Formula end end - # TODO: Move this into Library/Homebrew somewhere (see also mitmproxy.rb). - def wrap bin_file, pythonpath - bin_file = Pathname.new bin_file - libexec_bin = Pathname.new libexec/'bin' - libexec_bin.mkpath - mv bin_file, libexec_bin - bin_file.write <<-EOS.undent - #!/bin/sh - PYTHONPATH="#{pythonpath}:$PYTHONPATH" "#{libexec_bin}/#{bin_file.basename}" "$@" - EOS - end - def install + ENV.prepend_create_path 'PYTHONPATH', libexec+'lib/python2.7/site-packages' install_args = [ "setup.py", "install", "--prefix=#{libexec}" ] - python do - resource('pycrypto').stage { system python, *install_args } - resource('pyyaml').stage { system python, *install_args } - resource('paramiko').stage { system python, *install_args } - resource('markupsafe').stage { system python, *install_args } - resource('jinja2').stage { system python, *install_args } - if build.with? 'accelerate' - resource('python-keyczar').stage { system python, *install_args } - end - - inreplace 'lib/ansible/constants.py' do |s| - s.gsub! '/usr/share/ansible', share+'ansible' - s.gsub! '/etc/ansible', etc+'ansible' - end - - # The "main" ansible module is installed in the default location and - # in order for it to be usable, we add the private_site_packages - # to the __init__.py of ansible so the deps (PyYAML etc) are found. - inreplace 'lib/ansible/__init__.py', - "__author__ = 'Michael DeHaan'", - "__author__ = 'Michael DeHaan'; import site; site.addsitedir('#{python.private_site_packages}')" - - system python, "setup.py", "install", "--prefix=#{prefix}" + resource('pycrypto').stage { system "python", *install_args } + resource('pyyaml').stage { system "python", *install_args } + resource('paramiko').stage { system "python", *install_args } + resource('markupsafe').stage { system "python", *install_args } + resource('jinja2').stage { system "python", *install_args } + if build.with? 'accelerate' + resource('python-keyczar').stage { system "python", *install_args } + end + + inreplace 'lib/ansible/constants.py' do |s| + s.gsub! '/usr/share/ansible', share+'ansible' + s.gsub! '/etc/ansible', etc+'ansible' end + system "python", "setup.py", "install", "--prefix=#{prefix}" + man1.install Dir['docs/man/man1/*.1'] - Dir["#{bin}/*"].each do |bin_file| - wrap bin_file, python.site_packages - end + bin.env_script_all_files(libexec+'bin', :PYTHONPATH => ENV['PYTHONPATH']) end - def test + test do system "#{bin}/ansible", "--version" end end |
