summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorEitan Isaacson <eitan@monotonous.org>2011-04-29 23:22:45 -0700
committerEitan Isaacson <eitan@monotonous.org>2011-05-02 10:22:25 -0700
commit18c12607e1412702053132862e08070b0278b0a6 (patch)
tree1c0d2d7bc28f5e3c15f01bb98103da8e75490fbe /bin
parent72f755f6e1ea89bee617fb6faafa1868b07c0268 (diff)
downloadcaribou-18c12607e1412702053132862e08070b0278b0a6.tar.gz
Updated executables to be shell scripts.
Hopefully we set the right env variables.
Diffstat (limited to 'bin')
-rw-r--r--bin/antler-keyboard.in47
-rw-r--r--bin/caribou-preferences.in61
-rw-r--r--bin/caribou.in65
3 files changed, 85 insertions, 88 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 a0aa03f..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,58 +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]})")"
-# We can't rely on prefix if we're installed by relocated RPM. Instead, we
-# use __file__ and for now hope that lib is relative to bin.
-_dirname = os.path.dirname(__file__)
-sys.prefix = os.path.normpath(os.path.join(_dirname, '..'))
-libs = os.path.join(sys.prefix, 'lib',
- 'python@PYTHON_VERSION@', 'site-packages')
-# point to the proper site-packages path
-sys.path.insert(1, libs)
-
-# This might be run from the build dir.
-if os.path.abspath(_dirname) != "@prefix@/bin":
- srcdir = os.path.normpath(os.path.join(_dirname, '..'))
- sys.path.insert(1, srcdir)
- import caribou.common
- import caribou.ui
- caribou.data_path = os.path.abspath(os.path.join(_dirname,
- "@top_srcdir@",
- "data"))
-else:
- import caribou.common
- import caribou.ui
- caribou.data_path = os.path.join("@prefix@", "share", "caribou")
-
-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()"