[mousetrap/gnome3-wip: 34/240] Fix bin/mousetrap.sh (in-place runner).



commit fef97c983fd7ac1facd2e2683fc2103429e29dab
Author: Stoney Jackson <dr stoney gmail com>
Date:   Thu May 15 13:26:05 2014 -0400

    Fix bin/mousetrap.sh (in-place runner).

 bin/mousetrap.sh                |    4 +--
 src/mousetrap/inplace_runner.py |   43 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 3 deletions(-)
---
diff --git a/bin/mousetrap.sh b/bin/mousetrap.sh
index da96f47..5972cab 100755
--- a/bin/mousetrap.sh
+++ b/bin/mousetrap.sh
@@ -1,5 +1,3 @@
 #!/bin/bash
 test -z "$PROJECT_DIRECTORY" && . "$(dirname "$0")"/lib/environment_up.sh
-cd "$PROJECT_DIRECTORY"
-"$PROJECT_DIRECTORY/src/mousetrap/mousetrap"
-cd -
+"$PROJECT_DIRECTORY/src/mousetrap/inplace_runner.py"
diff --git a/src/mousetrap/inplace_runner.py b/src/mousetrap/inplace_runner.py
new file mode 100755
index 0000000..79b47c3
--- /dev/null
+++ b/src/mousetrap/inplace_runner.py
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+
+# MouseTrap
+#
+# Copyright 2009 Flavio Percoco Premoli
+#
+# This file is part of mouseTrap.
+#
+# MouseTrap is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License v2 as published
+# by the Free Software Foundation.
+#
+# mouseTrap is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with mouseTrap.  If not, see <http://www.gnu.org/licenses/>.
+
+# This script performs some clean up and will run mousetrap.  It will also
+# rerun mousetrap if it detects that mousetrap died an unnatural death.
+# IMPORTANT: Parts of this script have been taken from the Orcas launch script. Thanks!!
+
+#__id__        = "$Id$"
+#__version__   = "$Revision$"
+#__date__      = "$Date$"
+#__copyright__ = "Copyright (c) 2008 Flavio Percoco Premoli"
+#__license__   = "GPLv2"
+
+import sys
+import os.path
+
+def add_parent_directory_to_path():
+    absolute_path_to_parent_directory = os.path.abspath(os.path.dirname(__file__) + '/..')
+    sys.path.append(absolute_path_to_parent_directory)
+
+def run_mousetrap():
+    from mousetrap.controller import Controller
+    Controller().start()
+
+add_parent_directory_to_path()
+run_mousetrap()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]