Created
March 2, 2018 03:14
-
-
Save ppar/ee37218a957cf02e73a887169af1d622 to your computer and use it in GitHub Desktop.
Boa Constructor install script (/ instructions) for macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
###################################################################### | |
# Boa Constructor installation script for OS X / macOS | |
# | |
# This script tries to automate the installation of Boa Constructor | |
# https://bitbucket.org/cwt/boa-constructor on macOS. | |
# | |
# Tested on macOS Sierra / 10.12.6 / Darwin 16.7.0 | |
# | |
# Requirements: | |
# - Python 2.7 from Homebrew (macOS's native python won't obey our DYLD_LIBRARY_PATH properly) | |
# - virtualenv command | |
# | |
# Based on: | |
# - https://wiki.wxpython.org/wxPythonVirtualenvOnMac | |
# - https://bitbucket.org/cwt/boa-constructor/issues/3/cant-create-project-on-mac | |
###################################################################### | |
# Configuration parameters | |
# Set the path to your Brew python 2.7 binary: | |
#PYTHON_CMD=/usr/local/opt/home-brew/bin/python2.7 | |
PYTHON_CMD=/usr/local/bin/python2.7 | |
# Set your desired Boa installation path: | |
BOA_DIR=~/boa | |
###################################################################### | |
set -e | |
set -x | |
# Create installation directory | |
mkdir "${BOA_DIR}" | |
cd "${BOA_DIR}" | |
# Download and extract Boa Constructor | |
# - or use hg if you have it | |
curl -LO https://bitbucket.org/cwt/boa-constructor/get/fc7a7a661661.zip | |
unzip -q fc7a7a661661.zip | |
# Download and extract wxPython 2.9.5.0 (note: Boa will not work on newer wx versions. At least not 4.0) | |
# - or download the .dmg from sourceforge's website if the curl fails | |
curl -LOvv https://netcologne.dl.sourceforge.net/project/wxpython/wxPython/2.9.5.0/wxPython2.9-osx-2.9.5.0-cocoa-py2.7.dmg | |
hdiutil attach wxPython2.9-osx-2.9.5.0-cocoa-py2.7.dmg | |
pax -r -z -f /Volumes/wxPython2.9-osx-2.9.5.0-cocoa-py2.7/wxPython2.9-osx-cocoa-py2.7.pkg/Contents/Resources/wxPython2.9-osx-cocoa-py2.7.pax.gz -s '|usr/local/|wx/|' | |
hdiutil eject /Volumes/wxPython2.9-osx-2.9.5.0-cocoa-py2.7 | |
# Create a virtualenv | |
virtualenv -p $PYTHON_CMD venv | |
# Symlink wxPython into the virtualenv | |
for i in wx/bin/* ; do ln -s ../../$i venv/bin/ ; done | |
ln -s ../../../wx/lib/wxPython-2.9.5.0 venv/lib/python2.7/ | |
# Create a Boa startup script | |
echo cd \""${BOA_DIR}"\" > boa.sh | |
echo export PYTHONPATH="\"${BOA_DIR}/wx/lib/wxPython-2.9.5.0/lib/python2.7/site-packages/wx-2.9.5-osx_cocoa\"" >> boa.sh | |
echo export DYLD_LIBRARY_PATH="\"${BOA_DIR}/venv/lib/python2.7/wxPython-2.9.5.0/lib\"" >> boa.sh | |
echo export PYTHONHOME="\"${BOA_DIR}/venv\"" >> boa.sh | |
echo ${PYTHON_CMD} cwt-boa-constructor-fc7a7a661661/Boa.py >> boa.sh | |
chmod a+x boa.sh | |
# Done | |
set -x | |
echo "Installation complete. Run ${BOA_DIR}/boa.sh to start Boa Constructor" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment