source: orange/install-scripts/mac/bundle-build-hg.sh @ 11074:1f924d0625ed

Revision 11074:1f924d0625ed, 5.1 KB checked in by Ales Erjavec <ales.erjavec@…>, 16 months ago (diff)

Install/upgrade the latest 'distribute' package into the bundle.

  • Property exe set to *
Line 
1#!/bin/bash -e
2#
3# Build the orange Mac OSX bundle
4#
5# ./bundle-build-hg.sh work_dir revision bundle_output_file
6# ./bundle-build-hg.sh /private/tmp tip /private/tmp/orange-bundle-hg-tip.dmg
7#
8
9WORK_DIR=$1
10REVISION=$2
11BUNDLE=$3
12
13TMP_BUNDLE_DIR=${WORK_DIR}/bundle
14REPOS_DIR=${WORK_DIR}/repos
15
16# Remove leftovers if any
17if [ -e $TMP_BUNDLE_DIR ]; then
18    rm -rf $TMP_BUNDLE_DIR
19fi
20
21echo "Preaparing the bundle template"
22TEMPLATE_VERSION=`curl --silent http://orange.biolab.si/download/bundle-templates/CURRENT.txt`
23curl --silent http://orange.biolab.si/download/bundle-templates/Orange-template-${TEMPLATE_VERSION}.tar.gz | tar -xz -C $WORK_DIR
24#svn export --non-interactive http://orange.biolab.si/svn/orange/externals/trunk/install-scripts/mac/bundle/ $TMP_BUNDLE_DIR
25
26# Make repos dir if it does not yet exist
27if [ ! -e $REPOS_DIR ]; then
28    mkdir $REPOS_DIR
29fi
30
31#Python interpreter in the bundle
32PYTHON=${TMP_BUNDLE_DIR}/Orange.app/Contents/MacOS/python
33
34#easy_install script in the bundle
35EASY_INSTALL=${TMP_BUNDLE_DIR}/Orange.app/Contents/MacOS/easy_install
36
37#Python version
38PY_VER=`$PYTHON -c "import sys; print sys.version[:3]"`
39
40# First install/upgrade distrubute. The setup.py scripts might
41# need it
42echo "Installing/upgrading distribute in the bundle"
43echo "============================================="
44$EASY_INSTALL -U distribute
45
46
47echo "Checkouting and building orange"
48echo "==============================="
49./bundle-inject-hg.sh https://bitbucket.org/biolab/orange orange $REVISION $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
50
51echo "Specifically building orangeqt"
52echo "------------------------------"
53
54CUR_DIR=`pwd`
55cd $REPOS_DIR/orange/source/orangeqt
56echo "Fixing sip/pyqt configuration"
57
58APP=${TMP_BUNDLE_DIR}/Orange.app
59APP_ESCAPED=`echo ${TMP_BUNDLE_DIR}/Orange.app | sed s/'\/'/'\\\\\/'/g`
60sed -i.bak "s/Users.*Orange.app/$APP_ESCAPED/g"  $APP/Contents/Frameworks/Python.framework/Versions/$PY_VER/lib/python$PY_VER/site-packages/PyQt4/pyqtconfig.py
61sed -i.bak "s/Users.*Orange.app/$APP_ESCAPED/g"  $APP/Contents/Frameworks/Python.framework/Versions/$PY_VER/lib/python$PY_VER/site-packages/sipconfig.py
62export PATH=$APP/Contents/Resources/Qt4/bin:$PATH
63$PYTHON setup.py install
64cd $CUR_DIR
65
66echo "Fixing Qt plugins search path"
67echo "[Paths]
68Plugins = ../../../../../Resources/Qt4/plugins/" > $APP/Contents/Frameworks/Python.framework/Resources/Python.app/Contents/Resources/qt.conf
69
70
71echo "Checkouting and building bioinformatics addon"
72echo "============================================="
73./bundle-inject-hg.sh https://bitbucket.org/biolab/orange-bioinformatics bioinformatics $REVISION $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
74
75echo "Checkouting and building text addon"
76echo "==================================="
77./bundle-inject-hg.sh https://bitbucket.org/biolab/orange-text text $REVISION $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
78
79echo "Installing networkx"
80echo "+++++++++++++++++++"
81./bundle-inject-pypi.sh networkx-1.6 http://pypi.python.org/packages/source/n/networkx/networkx-1.6.tar.gz $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
82
83echo "Installing suds library"
84echo "+++++++++++++++++++++++"
85./bundle-inject-pypi.sh suds-0.4 http://pypi.python.org/packages/source/s/suds/suds-0.4.tar.gz $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
86
87echo "Removing unnecessary files."
88find $TMP_BUNDLE_DIR \( -name '*~' -or -name '*.bak' -or -name '*.pyc' -or -name '*.pyo' -or -name '*.pyd' \) -exec rm -rf {} ';'
89
90ln -s ../Frameworks/Python.framework/Versions/Current/lib/python${PY_VER}/site-packages/Orange ${TMP_BUNDLE_DIR}/Orange.app/Contents/Resources/Orange
91
92   
93echo "Preparing the .dmg image"
94echo "========================"
95
96# Makes a link to Applications folder
97ln -s /Applications/ $TMP_BUNDLE_DIR/Applications
98
99echo "Fixing bundle permissions."
100
101{ chown -Rh root:wheel $TMP_BUNDLE_DIR; } || { echo "Could not fix bundle permissions"; }
102
103echo "Creating temporary image with the bundle."
104
105TMP_BUNDLE=${WORK_DIR}/bundle.dmg
106rm -f $TMP_BUNDLE
107
108hdiutil detach /Volumes/Orange -force || true
109hdiutil create -format UDRW -volname Orange -fs HFS+ -fsargs "-c c=64,a=16,e=16" -srcfolder $TMP_BUNDLE_DIR $TMP_BUNDLE
110MOUNT_OUTPUT=`hdiutil attach -readwrite -noverify -noautoopen $TMP_BUNDLE | egrep '^/dev/'`
111DEV_NAME=`echo -n "$MOUNT_OUTPUT" | head -n 1 | awk '{print $1}'`
112MOUNT_POINT=`echo -n "$MOUNT_OUTPUT" | tail -n 1 | awk '{print $3}'`
113
114# Makes the disk image window open automatically when mounted
115bless -openfolder "$MOUNT_POINT"
116# Hides background directory even more
117/Developer/Tools/SetFile -a V "$MOUNT_POINT/.background/"
118# Sets the custom icon volume flag so that volume has nice Orange icon after mount (.VolumeIcon.icns)
119/Developer/Tools/SetFile -a C "$MOUNT_POINT"
120
121# Might mot have permissions to do this
122{ rm -rf "$MOUNT_POINT/.Trashes/"; } || { echo "Could not remove $MOUNT_POINT/.Trashes/"; }
123
124{ rm -rf "$MOUNT_POINT/.fseventsd/"; } || { echo "Could not remove $MOUNT_POINT/.fseventsd/"; }
125
126hdiutil detach "$DEV_NAME" -force
127
128echo "Converting temporary image to a compressed image."
129
130if [ -e $BUNDLE ]; then
131    rm -f $BUNDLE
132fi
133
134hdiutil convert $TMP_BUNDLE -format UDZO -imagekey zlib-level=9 -o $BUNDLE
135
136echo "Cleaning up."
137rm -f $TMP_BUNDLE
138rm -rf $TMP_BUNDLE_DIR
139
140true
Note: See TracBrowser for help on using the repository browser.