diff options
| author | Mike McQuaid | 2014-01-04 13:16:18 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2014-01-04 13:35:47 +0000 |
| commit | 6fb08707509962c14b428539722c083ebc8f898a (patch) | |
| tree | b59e98bf83fe31b44c83c773eaf90661a6b2e62f /Library | |
| parent | 21098dd22c6d3bc21ac35a18a9956b20d0ba6af2 (diff) | |
| download | homebrew-6fb08707509962c14b428539722c083ebc8f898a.tar.bz2 | |
saltstack: cleanup python usage.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/saltstack.rb | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/Library/Formula/saltstack.rb b/Library/Formula/saltstack.rb index 60e9bfbc1..94f9838cc 100644 --- a/Library/Formula/saltstack.rb +++ b/Library/Formula/saltstack.rb @@ -60,40 +60,24 @@ class Saltstack < Formula sha1 '5915f60033168a7b6f1e76ddb8a514f84ebcdf81' end - 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('pyzmq').stage { system python, *install_args } - resource('msgpack-python').stage { system python, *install_args } - resource('markupsafe').stage { system python, *install_args } - resource('m2crypto').stage { system python, *install_args } - resource('jinja2').stage { system python, *install_args } - end - - inreplace 'salt/__init__.py', - "import warnings", - "import warnings; import site; site.addsitedir('#{python.private_site_packages}')" - - system python, "setup.py", "install", "--prefix=#{prefix}" - Dir["#{bin}/*"].each do |bin_file| - wrap bin_file, python.site_packages - end - man1.install Dir['doc/man/*.1'] - man7.install Dir['doc/man/*.7'] + resource('pycrypto').stage { system "python", *install_args } + resource('pyyaml').stage { system "python", *install_args } + resource('pyzmq').stage { system "python", *install_args } + resource('msgpack-python').stage { system "python", *install_args } + resource('markupsafe').stage { system "python", *install_args } + resource('m2crypto').stage { system "python", *install_args } + resource('jinja2').stage { system "python", *install_args } + + system "python", "setup.py", "install", "--prefix=#{prefix}" + + man1.install Dir['doc/man/*.1'] + man7.install Dir['doc/man/*.7'] + + bin.env_script_all_files(libexec+'bin', :PYTHONPATH => ENV['PYTHONPATH']) end test do |
