Last active
December 30, 2015 12:09
-
-
Save diyan/7827593 to your computer and use it in GitHub Desktop.
Script that bootstraps dev environment for one Python project. Works on Windows (with installed Python 2.7.6 and msysgit) and Ubuntu Linux (out of box).
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
#!/bin/bash | |
set -e | |
OS=`uname` | |
mkdir -p pip_download_cache | |
if [ "$OS" == "Linux" ]; then | |
# libmysqlclient-dev -> mysql-python | |
# protobuf-compiler -> protobuf -> riak_pb -> riak | |
# libxml2-dev, libxslt1-dev -> lxml | |
echo install redis server that required for integration tests... | |
sudo apt-get install redis-server | |
sudo apt-get install -y python-virtualenv python-dev libmysqlclient-dev protobuf-compiler libxml2-dev libxslt1-dev | |
virtualenv . | |
. bin/activate | |
else | |
echo Install MinGW 64-bit C compiler | |
# Check more details here http://stackoverflow.com/a/15185029/836191 | |
#curl -L# http://downloads.sourceforge.net/project/mingwbuilds/host-windows/releases/4.8.0/64-bit/threads-win32/seh/x64-4.8.0-release-win32-seh-rev2.7z?r=&ts=1386342347&use_mirror=optimate > pip_download_cache/l64-4.8.0-release-win32-seh-rev2.7z | |
echo Install redis server that required for integration tests... | |
curl -L# https://github.com/downloads/dmajkic/redis/redis-2.4.5-win32-win64.zip > pip_download_cache/redis-2.4.5-win32-win64.zip | |
#TODO zipfile module can not extract zip with folders. Investigate workaround | |
#python -m zipfile -e pip_download_cache/redis-2.4.5-win32-win64.zip pip_download_cache/redis-2.4.5-win32-win64 | |
#cp pip_download_cache/redis-2.4.5-win32-win64/64bit/*.exe third_party/redis_win64/ | |
#cp pip_download_cache/redis-2.4.5-win32-win64/64bit/*.dll third_party/redis_win64/ | |
# NOTE On Ubuntu ve_setup.py script fails with "No module named _sysconfigdata_nd;" error | |
curl -L# http://tiny.cc/ve-setup > pip_download_cache/ve_setup.py | |
python pip_download_cache/ve_setup.py . | |
source Scripts/activate | |
curl -L# http://peak.telecommunity.com/dist/ez_setup.py > pip_download_cache/ez_setup.py | |
python pip_download_cache/ez_setup.py -U setuptools | |
echo Change default C compiler from MSVC into MinGW | |
cat > Lib/distutils/distutils.cfg << EOF | |
[build] | |
compiler=mingw32 | |
EOF | |
echo Fix MinGW compiler flags in cygwinccompiler.py for Python 2.7.6 | |
# Check more details here http://stackoverflow.com/a/19867426/836191 | |
sed -i "s/compiler_so='gcc%s -mdll -O -Wall'/compiler_so='gcc%s -mdll -O -Wall -D MS_WIN64'/" /c/Python27/Lib/distutils/cygwinccompiler.py | |
echo Install libpython and libmsvcr for use with MinGW | |
curl -L# https://dl.dropboxusercontent.com/u/54649947/python/libpython-1.0.win-amd64-py2.7.exe > pip_download_cache/libpython-1.0.win-amd64-py2.7.exe | |
python -m zipfile -e pip_download_cache/libpython-1.0.win-amd64-py2.7.exe pip_download_cache/libpython-1.0.win-amd64-py2.7 | |
cp -R pip_download_cache/libpython-1.0.win-amd64-py2.7/DATA/* /c/Python27 | |
curl -L# http://protobuf.googlecode.com/files/protoc-2.5.0-win32.zip > pip_download_cache/protoc-2.5.0-win32.zip | |
python -m zipfile -e pip_download_cache/protoc-2.5.0-win32.zip Scripts | |
curl -L# https://pypi.python.org/packages/2.7/l/lxml/lxml-3.2.4.win-amd64-py2.7.exe > pip_download_cache/lxml-3.2.4.win-amd64-py2.7.exe | |
#curl -L# https://dl.dropboxusercontent.com/u/54649947/python/MySQL-python-1.2.4.win-amd64-py2.7.exe > pip_download_cache/MySQL-python-1.2.4.win-amd64-py2.7.exe | |
curl -L# https://pypi.python.org/packages/2.7/g/greenlet/greenlet-0.4.1.win-amd64-py2.7.exe > pip_download_cache/greenlet-0.4.1.win-amd64-py2.7.exe | |
curl -L# https://pypi.python.org/packages/2.7/p/pyOpenSSL/pyOpenSSL-0.13.1.win-amd64-py2.7.exe > pip_download_cache/pyOpenSSL-0.13.1.win-amd64-py2.7.exe | |
easy_install --no-deps --always-unzip pip_download_cache/lxml-3.2.4.win-amd64-py2.7.exe | |
#easy_install --no-deps --always-unzip pip_download_cache/MySQL-python-1.2.4.win-amd64-py2.7.exe | |
easy_install --no-deps --always-unzip pip_download_cache/greenlet-0.4.1.win-amd64-py2.7.exe | |
python -m zipfile -e pip_download_cache/pyOpenSSL-0.13.1.win-amd64-py2.7.exe pip_download_cache/pyOpenSSL-0.13.1.win-amd64-py2.7 | |
cp -R pip_download_cache/pyOpenSSL-0.13.1.win-amd64-py2.7/PLATLIB/* Lib/site-packages | |
fi | |
pip install -r requirements.txt --use-mirrors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment