Skip to content

Instantly share code, notes, and snippets.

@jramnani
Last active December 14, 2015 03:59
Show Gist options
  • Save jramnani/5025094 to your computer and use it in GitHub Desktop.
Save jramnani/5025094 to your computer and use it in GitHub Desktop.
Install SaltStack (http://saltstack.org/) on OS X using Homebrew. Salt has native dependencies that are already in Homebrew, and I wanted to make it easier to install. I doubt this will make it into the official Homebrew formulas.
require 'formula'
class Saltstack < Formula
homepage 'http://saltstack.org'
url 'https://github.com/saltstack/salt/archive/v0.13.1.zip'
sha1 '56ee585b42c9f45330fb76f5a3c4bd2259a116a0'
depends_on 'libyaml'
depends_on 'msgpack'
depends_on 'swig' => :build
depends_on 'zeromq'
depends_on LanguageModuleDependency.new :python, 'distribute', 'setuptools'
def install
# In order to install into the Cellar, the dir must exist and be in the PYTHONPATH.
temp_site_packages = 'lib/#{which_python}/site-packages'
mkdir_p temp_site_packages
ENV['PYTHONPATH'] = temp_site_packages
args = [
"--no-user-cfg",
"--verbose",
"install",
"--force",
"--install-scripts=#{bin}",
"--install-lib=#{temp_site_packages}",
"--install-data=#{share}",
"--install-headers=#{include}",
]
# Required specifically for SaltStack
ENV["USE_SETUPTOOLS"] = "True"
system "python", "-s", "setup.py", *args
# Homebrew already includes distribute for us, so these files are extraneous.
rm_f temp_site_packages/'site.py'
rm_f temp_site_packages/'site.pyc'
rm_f temp_site_packages/'easy-install.pth'
end
def which_python
# Update this once we have something like [this](https://github.com/mxcl/homebrew/issues/11204)
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment