[caribou/geometry] Updated executables to be shell scripts.



commit dbd897e8bb933d09d2ff66601f356b564645f016
Author: Eitan Isaacson <eitan monotonous org>
Date:   Fri Apr 29 23:22:45 2011 -0700

    Updated executables to be shell scripts.
    
    Hopefully we set the right env variables.

 bin/antler-keyboard.in     |   47 +++++++++++++++++++++++----------
 bin/caribou-preferences.in |   61 +++++++++++++++++++++++++++++--------------
 bin/caribou.in             |   51 ++++++++----------------------------
 3 files changed, 85 insertions(+), 74 deletions(-)
---
diff --git a/bin/antler-keyboard.in b/bin/antler-keyboard.in
index 85d88ec..b42734c 100644
--- a/bin/antler-keyboard.in
+++ b/bin/antler-keyboard.in
@@ -1,18 +1,37 @@
-#!/usr/bin/env python
+#!/bin/bash
+#
+# Antler - a Caribou keyboard implementation
+#
+# Copyright (C) 2011 Eitan Isaacson <eitan monotonous org>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# This program 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 Lesser General Public License
+# for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
-import sys, os
-import traceback
+script_dir="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"
 
-libs = os.path.join('@prefix@', 'lib', 'python PYTHON_VERSION@', 'site-packages')
-
-# This might be run from the build dir.
-_dirname = os.path.dirname(__file__)
-if _dirname != "@prefix@/libexec":
-    libs = os.path.normpath(os.path.join(_dirname, '..'))
-
-sys.path.insert(1, libs)
+if [ $script_dir == "@prefix@@libexecdir@" ]
+then
+  export PYTHONPATH="@prefix@/lib/python PYTHON_VERSION@/site-packages:${PYTHONPATH}"
+  export GI_TYPELIB_PATH="@prefix@@libdir@/girepository-1.0:${GI_TYPELIB_PATH}"
+  export LD_LIBRARY_PATH="@prefix@@libdir@:${LD_LIBRARY_PATH}"
+  export XDG_DATA_DIRS="@prefix@@datadir@:${XDG_DATA_DIRS}"
+else
+  export PYTHONPATH="$(dirname $script_dir):${PYTHONPATH}"
+  export GI_TYPELIB_PATH="$(dirname $script_dir)/licaribou:${GI_TYPELIB_PATH}"
+  export LD_LIBRARY_PATH="$(dirname $script_dir)/licaribou/.lib:${LD_LIBRARY_PATH}"
+fi
 
+ PYTHON@ -c "
 from caribou.antler.main import AntlerKeyboardService
-
-antler_keyboard_service = AntlerKeyboardService()
-antler_keyboard_service.run()
+AntlerKeyboardService().run()"
diff --git a/bin/caribou-preferences.in b/bin/caribou-preferences.in
index a745bab..13948c8 100644
--- a/bin/caribou-preferences.in
+++ b/bin/caribou-preferences.in
@@ -1,27 +1,48 @@
-#!/usr/bin/python
-
-import sys, os
-
-libs = os.path.join('@prefix@', 'lib', 'python PYTHON_VERSION@', 'site-packages')
-
-# This might be run from the build dir.
-_dirname = os.path.dirname(__file__)
-if _dirname != "@prefix@/bin":
-    libs = os.path.normpath(os.path.join(_dirname, '..'))
-    
-sys.path.insert(1, libs)
-
-from gi.repository import Gtk
-from caribou.settings.settings_manager import SettingsManager
-from caribou.settings import CaribouSettings
-from caribou.settings.preferences_window import PreferencesWindow
-
+#!/bin/bash
+#
+# Antler - a Caribou keyboard implementation
+#
+# Copyright (C) 2011 Eitan Isaacson <eitan monotonous org>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation; either version 2.1 of the License, or (at your
+# option) any later version.
+#
+# This program 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 Lesser General Public License
+# for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+script_dir="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"
+
+if [ $script_dir == "@prefix@@libexecdir@" ]
+then
+  export PYTHONPATH="@prefix@/lib/python PYTHON_VERSION@/site-packages:${PYTHONPATH}"
+  export GI_TYPELIB_PATH="@libdir@/girepository-1.0:${GI_TYPELIB_PATH}"
+  export LD_LIBRARY_PATH="@libdir@:${LD_LIBRARY_PATH}"
+  export XDG_DATA_DIRS="@prefix@@datadir@:${XDG_DATA_DIRS}"
+else
+  export PYTHONPATH="$(dirname $script_dir):${PYTHONPATH}"
+  export GI_TYPELIB_PATH="$(dirname $script_dir)/licaribou:${GI_TYPELIB_PATH}"
+  export LD_LIBRARY_PATH="$(dirname $script_dir)/licaribou/.lib:${LD_LIBRARY_PATH}"
+fi
+
+ PYTHON@ -c "
 import signal
 signal.signal(signal.SIGINT, signal.SIG_DFL)
 
+from caribou.settings.preferences_window import PreferencesWindow
+from caribou.settings import CaribouSettings
+from gi.repository import Gtk
+
 w = PreferencesWindow(CaribouSettings())
 
-w.connect("delete-event", lambda x, y: Gtk.main_quit())
+w.connect('delete-event', lambda x, y: Gtk.main_quit())
 
 w.show_all()
 
@@ -29,4 +50,4 @@ try:
     Gtk.main()
 except KeyboardInterrupt:
     Gtk.main_quit()
-
+"
diff --git a/bin/caribou.in b/bin/caribou.in
index ac1debb..7bebd0d 100644
--- a/bin/caribou.in
+++ b/bin/caribou.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/bin/bash
 #
 # Caribou - text entry and UI navigation application
 #
@@ -24,44 +24,15 @@
 # along with this program; if not, write to the Free Software Foundation,
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
-from optparse import OptionParser
-import gettext
-import sys
-import pyatspi
-import os
+script_dir="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"
 
-libs = os.path.join('@prefix@', 'lib', 'python PYTHON_VERSION@', 'site-packages')
-
-# This might be run from the build dir.
-_dirname = os.path.dirname(__file__)
-if _dirname != "@prefix@/bin":
-    libs = os.path.normpath(os.path.join(_dirname, '..'))
-    
-sys.path.insert(1, libs)
-
-from caribou.daemon import CaribouDaemon
-
-_ = gettext.gettext
-    
-if __name__ == "__main__":
-    import signal
-
-    signal.signal(signal.SIGINT, signal.SIG_DFL)
-
-    parser = OptionParser(usage="usage: %prog [options]",
-                          version="%prog @VERSION@")
-    parser.add_option("-d", "--debug",
-                      action="store_true", dest="debug", default=False,
-                      help="print debug messages on stdout")
-    (options, args) = parser.parse_args()
-
-    #main.debug = options.debug
-
-    caribou = CaribouDaemon()
- 
-    try:
-        pyatspi.Registry.start()
-    except KeyboardInterrupt:
-        caribou.clean_exit()
-        pyatspi.Registry.stop()
+if [ $script_dir == "@prefix@/bin" ]
+then
+  export PYTHONPATH="@prefix@/lib/python PYTHON_VERSION@/site-packages:${PYTHONPATH}"
+  export GI_TYPELIB_PATH="@libdir@/girepository-1.0":${GI_TYPELIB_PATH}
+else
+  export PYTHONPATH="$(dirname $script_dir):${PYTHONPATH}"
+  export GI_TYPELIB_PATH="$(dirname $script_dir)/licaribou":${GI_TYPELIB_PATH}
+fi
 
+ PYTHON@ -c "from caribou.daemon.main import CaribouDaemon; CaribouDaemon().run()"



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