From 004a887e48192698d2caf69d8b0921284fa747ce Mon Sep 17 00:00:00 2001 From: Dario Giovannetti Date: Mon, 8 Jan 2018 00:42:51 +0800 Subject: [PATCH] Try to address #381 --- dev/mkvenv.sh | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 dev/mkvenv.sh diff --git a/dev/mkvenv.sh b/dev/mkvenv.sh new file mode 100755 index 00000000..2eec3b96 --- /dev/null +++ b/dev/mkvenv.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash + +version="0.8.3" +envdir="osenv" + +if [ -d $envdir ]; then + read -p "The $envdir directory already exists, remove it? [y|n]" -n 1 -s remove + echo + if [ $remove = "y" ]; then + rm -rf $envdir + else + echo "Activate the virtualenv and execute outspline:" + echo " $ cd $envdir" + echo " $ ./bin/activate" + echo " $ ./bin/outspline --config ./outspline.conf" + echo + echo "Deactivate the virtualenv when done:" + echo " $ deactivate" + exit 1 + fi +fi + +if ! python2 -c "import wx" &> /dev/null; then + echo "Install wxPython for this distribution." + echo "For example on Ubuntu:" + echo " # apt-get install python-wxgtk3.0" + echo + echo "Or on Arch:" + echo " # pacman -S wxpython" + exit 1 +fi + +if command -v pacman &> /dev/null; then + # Arch + if ! pacman -Q python2-gobject &> /dev/null; then + echo "Install python2-gobject to support notifications:" + echo " # pacman -S python2-gobject" + read -p "Continue without notifications? [y|n]" -n 1 -s cont + echo + if [ $cont != "y" ]; then + exit 1 + fi + fi +elif command -v dpkg &> /dev/null; then + # Ubuntu + if ! dpkg -s python-gobject &> /dev/null; then + echo "Install python-gobject to support notifications:" + echo " # apt-get install python-gobject" + read -p "Continue without notifications? [y|n]" -n 1 -s cont + echo + if [ $cont != "y" ]; then + exit 1 + fi + fi +fi + +if command -v virtualenv2 &> /dev/null; then + # Arch + virtualenv2 --system-site-packages $envdir +else + # Ubuntu + virtualenv --system-site-packages $envdir +fi + +cd $envdir +source ./bin/activate + +package="http://downloads.sourceforge.net/project/outspline/main/outspline-$version.tar.bz2" + +if command -v curl &> /dev/null; then + # Arch + curl -LO $package +else + # Ubuntu... + wget $package +fi + +tar xjf "outspline-$version.tar.bz2" +cd "outspline-$version" +../bin/python setup.py install --optimize=1 +cd .. + +# On the main system the icon cache may have to be refreshed +#gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor + +# Also, without root rights, icons can't be installed in /usr/share/icons, +# therefore e.g. the tray icon doesn't appear + +./bin/outspline --config ./outspline.conf + +deactivate