Merge pull request #2448 from nneonneo/2447-support-macports

Support MacPorts on OS X. This fixes #2447.
This commit is contained in:
bmw
2016-04-04 12:11:13 -07:00
2 changed files with 60 additions and 26 deletions
+30 -13
View File
@@ -348,28 +348,45 @@ BootstrapFreeBsd() {
} }
BootstrapMac() { BootstrapMac() {
if ! hash brew 2>/dev/null; then if hash brew 2>/dev/null; then
echo "Homebrew not installed.\nDownloading..." echo "Using Homebrew to install dependencies..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" pkgman=brew
pkgcmd="brew install"
elif hash port 2>/dev/null; then
echo "Using MacPorts to install dependencies..."
pkgman=port
pkgcmd="$SUDO port install"
else
echo "No Homebrew/MacPorts; installing Homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
pkgman=brew
pkgcmd="brew install"
fi fi
if [ -z "$(brew list --versions augeas)" ]; then $pkgcmd augeas
echo "augeas not installed.\nInstalling augeas from Homebrew..." $pkgcmd dialog
brew install augeas if [ "$(which python)" = "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python" ]; then
# We want to avoid using the system Python because it requires root to use pip.
# python.org, MacPorts or HomeBrew Python installations should all be OK.
echo "Installing python..."
$pkgcmd python
fi fi
if [ -z "$(brew list --versions dialog)" ]; then # Workaround for _dlopen not finding augeas on OS X
echo "dialog not installed.\nInstalling dialog from Homebrew..." if [ "$pkgman" = "port" ] && ! [ -e "/usr/local/lib/libaugeas.dylib" ] && [ -e "/opt/local/lib/libaugeas.dylib" ]; then
brew install dialog echo "Applying augeas workaround"
$SUDO ln -s /opt/local/lib/libaugeas.dylib /usr/local/lib
fi fi
if [ -z "$(brew list --versions python)" ]; then if ! hash pip 2>/dev/null; then
echo "python not installed.\nInstalling python from Homebrew..." echo "pip not installed"
brew install python echo "Installing pip..."
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python
fi fi
if ! hash virtualenv 2>/dev/null; then if ! hash virtualenv 2>/dev/null; then
echo "virtualenv not installed.\nInstalling with pip..." echo "virtualenv not installed."
echo "Installing with pip..."
pip install virtualenv pip install virtualenv
fi fi
} }
@@ -1,26 +1,43 @@
BootstrapMac() { BootstrapMac() {
if ! hash brew 2>/dev/null; then if hash brew 2>/dev/null; then
echo "Homebrew not installed.\nDownloading..." echo "Using Homebrew to install dependencies..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" pkgman=brew
pkgcmd="brew install"
elif hash port 2>/dev/null; then
echo "Using MacPorts to install dependencies..."
pkgman=port
pkgcmd="$SUDO port install"
else
echo "No Homebrew/MacPorts; installing Homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
pkgman=brew
pkgcmd="brew install"
fi fi
if [ -z "$(brew list --versions augeas)" ]; then $pkgcmd augeas
echo "augeas not installed.\nInstalling augeas from Homebrew..." $pkgcmd dialog
brew install augeas if [ "$(which python)" = "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python" ]; then
# We want to avoid using the system Python because it requires root to use pip.
# python.org, MacPorts or HomeBrew Python installations should all be OK.
echo "Installing python..."
$pkgcmd python
fi fi
if [ -z "$(brew list --versions dialog)" ]; then # Workaround for _dlopen not finding augeas on OS X
echo "dialog not installed.\nInstalling dialog from Homebrew..." if [ "$pkgman" = "port" ] && ! [ -e "/usr/local/lib/libaugeas.dylib" ] && [ -e "/opt/local/lib/libaugeas.dylib" ]; then
brew install dialog echo "Applying augeas workaround"
$SUDO ln -s /opt/local/lib/libaugeas.dylib /usr/local/lib
fi fi
if [ -z "$(brew list --versions python)" ]; then if ! hash pip 2>/dev/null; then
echo "python not installed.\nInstalling python from Homebrew..." echo "pip not installed"
brew install python echo "Installing pip..."
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python
fi fi
if ! hash virtualenv 2>/dev/null; then if ! hash virtualenv 2>/dev/null; then
echo "virtualenv not installed.\nInstalling with pip..." echo "virtualenv not installed."
echo "Installing with pip..."
pip install virtualenv pip install virtualenv
fi fi
} }