aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2014-01-04 13:01:30 +0000
committerMike McQuaid2014-01-04 13:19:20 +0000
commit309af20c13c2fbb9b1bf41921ea8cd94ca58d7cb (patch)
tree58134d4445a66a327139f58a1ec9fbc2f69e368a /Library
parent86a9beda9f09094bd0f6289d106e7e0abb78ae7a (diff)
downloadhomebrew-309af20c13c2fbb9b1bf41921ea8cd94ca58d7cb.tar.bz2
ansible: cleanup python usage.
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/ansible.rb56
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