Changeset 11594:4472f0f29bce in orange


Ignore:
Timestamp:
06/13/13 18:22:19 (10 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Changed Orange Canvas OSX application startup script.

Start the application through a symlink in the top level application
directory so the correct Info.plist is considered by OSX (otherwise the one
in the contained Python.app is used).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • install-scripts/mac/bundle-build-hg.sh

    r11533 r11594  
    2020 
    2121echo "Preaparing the bundle template" 
    22 TEMPLATE_VERSION=`curl --silent http://orange.biolab.si/download/bundle-templates/CURRENT.txt` 
     22TEMPLATE_VERSION=$(curl --silent http://orange.biolab.si/download/bundle-templates/CURRENT.txt) 
    2323curl --silent http://orange.biolab.si/download/bundle-templates/Orange-template-${TEMPLATE_VERSION}.tar.gz | tar -xz -C $WORK_DIR 
    2424 
     
    2828fi 
    2929 
    30 # Create bundle startup script 
    31 cat <<-'EOF' > ${TMP_BUNDLE_DIR}/Orange.app/Contents/MacOS/Orange 
     30APP=${TMP_BUNDLE_DIR}/Orange.app 
     31 
     32# Python interpreter in the bundle 
     33PYTHON=${APP}/Contents/MacOS/python 
     34 
     35# Python version 
     36PY_VER=`$PYTHON -c "import sys; print sys.version[:3]"` 
     37 
     38SITE_PACKAGES=${APP}/Contents/Frameworks/Python.framework/Versions/${PY_VER}/lib/python${PY_VER}/site-packages/ 
     39 
     40# easy_install script in the bundle 
     41EASY_INSTALL=${APP}/Contents/MacOS/easy_install 
     42 
     43# Link Python.app startup script to top bundle 
     44ln -fs ../Frameworks/Python.framework/Versions/Current/Resources/Python.app/Contents/MacOS/Python ${APP}/Contents/MacOS/PythonAppStart 
     45 
     46echo "Preparing startup scripts" 
     47 
     48# Create an enironment startup script 
     49cat <<-'EOF' > $APP/Contents/MacOS/ENV 
     50    # Create an environment for running python from the bundle 
     51    # Should be run as "source ENV" 
     52 
     53    BUNDLE_DIR=`dirname "$0"`/../ 
     54    BUNDLE_DIR=`perl -MCwd=realpath -e 'print realpath($ARGV[0])' "$BUNDLE_DIR"`/ 
     55    FRAMEWORKS_DIR="$BUNDLE_DIR"Frameworks/ 
     56    RESOURCES_DIR="$BUNDLE_DIR"Resources/ 
     57 
     58    PYVERSION="2.7" 
     59 
     60    PYTHONEXECUTABLE="$FRAMEWORKS_DIR"Python.framework/Resources/Python.app/Contents/MacOS/Python 
     61    PYTHONHOME="$FRAMEWORKS_DIR"Python.framework/Versions/"$PYVERSION"/ 
     62 
     63    DYLD_FRAMEWORK_PATH="$FRAMEWORKS_DIR"${DYLD_FRAMEWORK_PATH:+:$DYLD_FRAMEWORK_PATH} 
     64 
     65    export PYTHONEXECUTABLE 
     66    export PYTHONHOME 
     67 
     68    export DYLD_FRAMEWORK_PATH 
     69 
     70    # Some non framework libraries are put in $FRAMEWORKS_DIR by macho_standalone 
     71    export DYLD_LIBRARY_PATH="$FRAMEWORKS_DIR"${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH} 
     72EOF 
     73 
     74# Create Orange application startup script 
     75cat <<-'EOF' > ${APP}/Contents/MacOS/Orange 
    3276    #!/bin/bash 
    3377 
    34     source `dirname "$0"`/ENV 
     78    DIRNAME=$(dirname "$0") 
     79    source "$DIRNAME"/ENV 
    3580 
    3681    # LaunchServices passes the Carbon process identifier to the application with 
     
    4085    fi 
    4186 
    42     exec -a "$0" "$PYTHONEXECUTABLE" -m Orange.OrangeCanvas.main "$@" 
     87    exec -a "$0" "$DIRNAME"/PythonAppStart -m Orange.OrangeCanvas.main "$@" 
    4388EOF 
    4489 
    45 chmod +x ${TMP_BUNDLE_DIR}/Orange.app/Contents/MacOS/Orange 
    46  
    47 # Python interpreter in the bundle 
    48 PYTHON=${TMP_BUNDLE_DIR}/Orange.app/Contents/MacOS/python 
    49  
    50 # easy_install script in the bundle 
    51 EASY_INSTALL=${TMP_BUNDLE_DIR}/Orange.app/Contents/MacOS/easy_install 
    52  
    53 #Python version 
    54 PY_VER=`$PYTHON -c "import sys; print sys.version[:3]"` 
     90chmod +x ${APP}/Contents/MacOS/Orange 
    5591 
    5692# First install/upgrade distrubute. The setup.py scripts might 
     
    6399echo "Checkouting and building orange" 
    64100echo "===============================" 
    65 ./bundle-inject-hg.sh https://bitbucket.org/biolab/orange orange $REVISION $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app 
     101./bundle-inject-hg.sh https://bitbucket.org/biolab/orange orange $REVISION $REPOS_DIR ${APP} 
    66102 
    67103echo "Specifically building orangeqt" 
    68104echo "------------------------------" 
    69105 
    70 CUR_DIR=`pwd` 
    71 cd $REPOS_DIR/orange/source/orangeqt 
     106pushd $REPOS_DIR/orange/source/orangeqt 
    72107echo "Fixing sip/pyqt configuration" 
    73108 
    74 APP=${TMP_BUNDLE_DIR}/Orange.app 
    75 APP_ESCAPED=`echo ${TMP_BUNDLE_DIR}/Orange.app | sed s/'\/'/'\\\\\/'/g` 
    76 sed -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 
    77 sed -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 
     109sed -i.bak "s@/Users/.*/Orange.app/@$APP/@g" ${SITE_PACKAGES}/PyQt4/pyqtconfig.py 
     110sed -i.bak "s@/Users/.*/Orange.app/@$APP/@g" ${SITE_PACKAGES}/sipconfig.py 
    78111export PATH=$APP/Contents/Resources/Qt4/bin:$PATH 
    79112$PYTHON setup.py install 
    80 cd $CUR_DIR 
     113 
     114popd 
    81115 
    82116echo "Fixing Qt plugins search path" 
     
    84118Plugins = ../../../../../Resources/Qt4/plugins/" > $APP/Contents/Frameworks/Python.framework/Resources/Python.app/Contents/Resources/qt.conf 
    85119 
     120echo "[Paths] 
     121Plugins = Resources/Qt4/plugins/" > $APP/Contents/Resources/qt.conf 
     122 
    86123 
    87124echo "Checkouting and building bioinformatics addon" 
    88125echo "=============================================" 
    89 ./bundle-inject-hg.sh https://bitbucket.org/biolab/orange-bioinformatics bioinformatics tip $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app 
     126./bundle-inject-hg.sh https://bitbucket.org/biolab/orange-bioinformatics bioinformatics tip $REPOS_DIR ${APP} 
    90127 
    91128echo "Checkouting and building text addon" 
    92129echo "===================================" 
    93 ./bundle-inject-hg.sh https://bitbucket.org/biolab/orange-text text tip $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app 
     130./bundle-inject-hg.sh https://bitbucket.org/biolab/orange-text text tip $REPOS_DIR ${APP} 
    94131 
    95132echo "Installing networkx" 
    96133echo "+++++++++++++++++++" 
    97 ./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 
     134./bundle-inject-pypi.sh networkx-1.6 http://pypi.python.org/packages/source/n/networkx/networkx-1.6.tar.gz $REPOS_DIR ${APP} 
    98135 
    99136echo "Installing suds library" 
    100137echo "+++++++++++++++++++++++" 
    101 ./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 
     138./bundle-inject-pypi.sh suds-0.4 http://pypi.python.org/packages/source/s/suds/suds-0.4.tar.gz $REPOS_DIR ${APP} 
    102139 
    103140echo "Instaling slumber library" 
     
    108145find $TMP_BUNDLE_DIR \( -name '*~' -or -name '*.bak' -or -name '*.pyc' -or -name '*.pyo' -or -name '*.pyd' \) -exec rm -rf {} ';' 
    109146 
    110 ln -s ../Frameworks/Python.framework/Versions/Current/lib/python${PY_VER}/site-packages/Orange ${TMP_BUNDLE_DIR}/Orange.app/Contents/Resources/Orange 
     147ln -s ../Frameworks/Python.framework/Versions/Current/lib/python${PY_VER}/site-packages/Orange ${APP}/Contents/Resources/Orange 
    111148 
    112149     
Note: See TracChangeset for help on using the changeset viewer.