summarylogtreecommitdiffstats
path: root/bcnc-git
diff options
context:
space:
mode:
Diffstat (limited to 'bcnc-git')
-rwxr-xr-xbcnc-git21
1 files changed, 14 insertions, 7 deletions
diff --git a/bcnc-git b/bcnc-git
index 90f9da7a6366..ba20a88a5536 100755
--- a/bcnc-git
+++ b/bcnc-git
@@ -1,9 +1,16 @@
#!/usr/bin/env sh
-DIR=/opt/bcnc-git
-PYTHONPATH=${DIR}:${DIR}/lib:${DIR}/plugins
-export DIR PYTHONPATH
-if [ .$PYTHON = . ]; then
- PYTHON=python2
-fi
-${PYTHON} ${DIR}/bCNC.py $*
+#Autodetect python version
+[ .$PYTHON = . ] && PYTHON=`which python2`
+[ .$PYTHON = . ] && PYTHON=python
+
+#Autodetect bCNC install
+#If this script is placed in directory with bCNC module it will launch it
+#When placed somewhere else (eg. /usr/bin) it will launch bCNC from system
+DIR=`dirname $0`
+[ -f "${DIR}"/bCNC-git/__main__.py ] && cd "${DIR}" &&
+ echo "Launching bCNC from ${DIR}" ||
+ echo "Launching local installation of bCNC"
+
+#Launch
+"$PYTHON" -m bCNC-git $*