From f56125df96aaf5f33424c537e44d38def01729ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 21 Jan 2013 15:07:02 +0100 Subject: [PATCH] Redone launcher from Bash to Python --- scripts/linux/cura.py | 24 ++++++++++++++++++++++++ scripts/linux/cura.sh | 36 ------------------------------------ 2 files changed, 24 insertions(+), 36 deletions(-) create mode 100755 scripts/linux/cura.py delete mode 100755 scripts/linux/cura.sh diff --git a/scripts/linux/cura.py b/scripts/linux/cura.py new file mode 100755 index 00000000..e6340762 --- /dev/null +++ b/scripts/linux/cura.py @@ -0,0 +1,24 @@ +#!/usr/bin/python + +import os, sys + +try: + import OpenGL + import wx + import serial + import numpy + import power +except ImportError as e: + module = e.message.lstrip('No module named ') + print 'Requires ' + module + + if module == 'power': + print "Install from: https://github.com/GreatFruitOmsk/Power" + else: + print "Try sudo easy_install " + module + +sys.path.insert(1, os.path.dirname(__file__)) + +import Cura.cura as cura + +cura.main() diff --git a/scripts/linux/cura.sh b/scripts/linux/cura.sh deleted file mode 100755 index a1988431..00000000 --- a/scripts/linux/cura.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -python -c 'import OpenGL' -if [ $? != 0 ]; then - echo "Requires PyOpenGL" - echo " sudo easy_install-2.7 PyOpenGL" - exit 1 -fi - -python -c 'import wx' -if [ $? != 0 ]; then - echo "Requires wxPython" - exit 1 -fi - -python -c 'import serial' -if [ $? != 0 ]; then - echo "Requires pyserial." - exit 1 -fi - -python -c 'import numpy' -if [ $? != 0 ]; then - echo "Requires numpy." - exit 1 -fi - -python -c 'import power' -if [ $? != 0 ]; then - echo "Requires power module from https://github.com/GreatFruitOmsk/Power." - exit 1 -fi - -SCRIPT_DIR=`dirname $0` -cd $SCRIPT_DIR -python -m Cura.cura $@ -- 2.30.2