aboutsummaryrefslogtreecommitdiff
path: root/bin/genenetwork2
diff options
context:
space:
mode:
Diffstat (limited to 'bin/genenetwork2')
-rwxr-xr-xbin/genenetwork256
1 files changed, 43 insertions, 13 deletions
diff --git a/bin/genenetwork2 b/bin/genenetwork2
index 30a4dc95..889401fd 100755
--- a/bin/genenetwork2
+++ b/bin/genenetwork2
@@ -17,29 +17,33 @@
#
# Environment settings can be used to preconfigure as well as a
# settings.py file.
+#
+# GN2_BASE_PATH is base directory of wqflask source code
+#
SCRIPT=$(readlink -f "$0")
-GN2_BASE_PATH=$(dirname $(dirname "$SCRIPT"))
+GN2_BASE_DIR=$(dirname $(dirname "$SCRIPT"))
+
+echo GN2_BASE_DIR=$GN2_BASE_DIR
-GN2_GUIX_PATH=$GN2_BASE_PATH/lib/python2.7/site-packages/genenetwork2-2.0-py2.7.egg
-if [ -d $GN2_GUIX_PATH ]; then
- echo GN2 is running from GUIX
- GN2_BASE_PATH=$GN2_GUIX_PATH
-fi
-echo $GN2_BASE_PATH
# Handle settings parameter (can be .py or .json)
settings=$1
ext="${settings##*.}"
if [ -z "$settings" -o "$ext" = "json" -o "$ext" = "JSON" ]; then
overrides=$settings
- settings=$GN2_BASE_PATH/etc/default_settings.py
+ settings=$GN2_BASE_DIR/etc/default_settings.py
else
shift
fi
if [ ! -e $settings ]; then
- echo "ERROR: can not locate settings file - pass it in the command line"
- exit 1
+ GUIX_ETC=$GN2_BASE_DIR/lib/python2.7/site-packages/genenetwork2-2.0-py2.7.egg
+ if [ -d $GUIX_ETC ]; then
+ echo INFO: GN2 is actually running from GNU Guix
+ else
+ echo "ERROR: can not locate settings file - pass it in the command line"
+ exit 1
+ fi
fi
export WQFLASK_SETTINGS=$settings # Python
export WQFLASK_OVERRIDES=$overrides # JSON
@@ -47,17 +51,43 @@ export WQFLASK_OVERRIDES=$overrides # JSON
echo WQFLASK_SETTINGS=$settings
echo WQFLASK_OVERRIDES=$overrides
+# ---- Checks and balances
+if [ -z $GUIX_ETC ]; then
+ if [ -z $GN2_PROFILE ] ; then
+ echo "WARNING: GN2_PROFILE has not been set - I hope you know what you are doing"
+ else
+ export PYTHONPATH=$GN2_PROFILE/lib/python2.7/site-packages
+ export R_LIBS_SITE=$GN2_PROFILE/site-library
+ export GUIX_GTK3_PATH="$GN2_PROFILE/lib/gtk-3.0"
+ export GI_TYPELIB_PATH="$GN2_PROFILE/lib/girepository-1.0"
+ export XDG_DATA_DIRS="$GN2_PROFILE/share"
+ export GIO_EXTRA_MODULES="$GN2_PROFILE/lib/gio/modules"
+ fi
+ if [ -z $PYTHONPATH ] ; then
+ echo "WARNING PYTHONPATH has not been set"
+ fi
+ if [ ! -d $R_LIBS_SITE ] ; then
+ echo "ERROR: R_LIBS_SITE has not been set correctly (we only allow one path)"
+ echo "Paste in the output of, for example,"
+ echo "guix package -p /usr/local/guix-profiles/gn2-staging --search-paths"
+ exit 1
+ fi
+fi
+
# We may change this one:
-export PYTHONPATH=$GN2_BASE_PATH/wqflask:$PYTHONPATH
+export PYTHONPATH=$GN2_BASE_DIR/wqflask:$PYTHONPATH
# TEMPDIR defaults to /tmp if nothing else
if [ -z $TEMPDIR ]; then
TEMPDIR="/tmp"
fi
+set|grep $GN2_PROFILE
+set|grep TEMPDIR
+
# Now handle command parameter -c
if [ "$1" = '-c' ] ; then
- cd $GN2_BASE_PATH/wqflask
+ cd $GN2_BASE_DIR/wqflask
cmd=${2#wqflask/}
echo PYTHONPATH=$PYTHONPATH
echo RUNNING COMMAND $cmd
@@ -71,6 +101,6 @@ dbfilename gn2.rdb
" | redis-server - &
# Start the flask server running GN2
-cd $GN2_BASE_PATH/wqflask
+cd $GN2_BASE_DIR/wqflask
echo "Starting with $settings"
/usr/bin/env python runserver.py