[kupfer] Add kupfer-exec as main command execution program
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] Add kupfer-exec as main command execution program
- Date: Thu, 11 Feb 2010 16:58:39 +0000 (UTC)
commit 73ac06619bf9584f908ea1cd75ce3d811b9e9a1b
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Wed Feb 10 04:01:25 2010 +0100
Add kupfer-exec as main command execution program
Also document kupfer-exec in man page
Add kupfer-exec.desktop as default opener for kupfer exec files
Put the .desktop files in auxdata since they are not installed into
kupfer's own data directory.
Documentation/Quickstart.rst | 6 +++++-
auxdata/kupfer-exec.desktop.in | 8 ++++++++
{data => auxdata}/kupfer.desktop.in | 0
auxdata/wscript_build | 19 +++++++++++++++++++
bin/kupfer-exec | 26 ++++++++++++++++++++++++++
data/wscript_build | 15 ---------------
po/POTFILES.in | 3 ++-
wscript | 14 ++++++++++----
8 files changed, 70 insertions(+), 21 deletions(-)
---
diff --git a/Documentation/Quickstart.rst b/Documentation/Quickstart.rst
index 1fb6f93..14d0d52 100644
--- a/Documentation/Quickstart.rst
+++ b/Documentation/Quickstart.rst
@@ -13,7 +13,8 @@ Convenient command and access tool for applications and documents
SYNOPSIS
========
-``kupfer`` [ *OPTIONS* | *QUERY* ]
+| ``kupfer`` [ *OPTIONS* | *QUERY* ]
+| ``kupfer-exec`` *FILE* ...
DESCRIPTION
===========
@@ -27,6 +28,9 @@ Kupfer is written using Python and has a flexible architecture; the
implementation is simple and makes the easy things work first. One goal
is that new plugins can be written quickly without too much programming.
+``kupfer-exec`` is a helper script that can execute commands saved to
+file, but only by connecting to an already running instace of Kupfer.
+
SPAWNING
========
diff --git a/auxdata/kupfer-exec.desktop.in b/auxdata/kupfer-exec.desktop.in
new file mode 100644
index 0000000..51221b8
--- /dev/null
+++ b/auxdata/kupfer-exec.desktop.in
@@ -0,0 +1,8 @@
+
+[Desktop Entry]
+Version=1.0
+Type=Application
+Exec=kupfer-exec %F
+_Name=Execute in Kupfer
+NoDisplay=true
+MimeType=text/x-kfcom;
diff --git a/data/kupfer.desktop.in b/auxdata/kupfer.desktop.in
similarity index 100%
rename from data/kupfer.desktop.in
rename to auxdata/kupfer.desktop.in
diff --git a/auxdata/wscript_build b/auxdata/wscript_build
new file mode 100644
index 0000000..f59ea2d
--- /dev/null
+++ b/auxdata/wscript_build
@@ -0,0 +1,19 @@
+# merge translations into the .desktop file
+# and set it up to be installed
+def install_desktop_file(desktop_subst_file):
+ bld.new_task_gen(
+ "intltool_in",
+ podir="../po",
+ flags = ("-d", "-q", "-u", "-c"),
+ source = desktop_subst_file + ".in",
+ target = desktop_subst_file,
+ install_path = "${DATADIR}/applications",
+ chmod = 0755,
+ )
+
+install_desktop_file("kupfer.desktop")
+install_desktop_file("kupfer-exec.desktop")
+
+# install mimetype descriptions
+
+bld.install_files("${DATADIR}/mime/packages/", "kupfer-mimetypes.xml")
diff --git a/bin/kupfer-exec b/bin/kupfer-exec
new file mode 100755
index 0000000..2bc8d18
--- /dev/null
+++ b/bin/kupfer-exec
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+# This is a helper program to execute saved command files,
+# by sending them to a running instance of Kupfer.
+
+if test ! -f "$1"
+then
+ echo "A file argument required"
+ exit 1
+fi
+
+while test $# != 0
+do
+ FILE=$(realpath -s "$1")
+ dbus-send --print-reply --dest=se.kaizer.kupfer /interface \
+ se.kaizer.kupfer.Listener.ExecuteFile string:"$FILE" \
+ > /dev/null 2>&1
+ KUPFER_RUNNING=$?
+
+ if test $KUPFER_RUNNING != 0
+ then
+ zenity --info --text "Kupfer was not found running" &
+ exit 1
+ fi
+ shift
+done
diff --git a/data/wscript_build b/data/wscript_build
index fbb2000..78bc971 100644
--- a/data/wscript_build
+++ b/data/wscript_build
@@ -5,18 +5,3 @@ bld.install_files("${DATADIR}/kupfer", "*.ui")
# install all pure data files
bld.install_files("${DATADIR}/kupfer/art", "art/*")
bld.install_files("${DATADIR}/kupfer/searchplugins", "searchplugins/*")
-
-# merge translations into the .desktop file
-# and set it up to be installed
-desktop_subst_file = "kupfer.desktop"
-dtptrans = bld.new_task_gen(
- "intltool_in",
- podir="../po",
- flags = ("-d", "-q", "-u", "-c"),
- source = desktop_subst_file + ".in",
- target = desktop_subst_file,
- install_path = "${DATADIR}/applications",
- chmod = 0755,
-)
-
-
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 304b048..50e6acc 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,7 +1,8 @@
# encoding: UTF-8
# Order: Data files, Regular modules, Object modules, Plugins
-data/kupfer.desktop.in
+auxdata/kupfer.desktop.in
+auxdata/kupfer-exec.desktop.in
[type: gettext/glade] data/preferences.ui
[type: gettext/glade] data/result.ui
[type: gettext/glade] data/credentials_dialog.ui
diff --git a/wscript b/wscript
index 8dae578..40524a3 100644
--- a/wscript
+++ b/wscript
@@ -199,11 +199,13 @@ def build(bld):
binary_subst_file = "kupfer-activate.sh"
bin = bld.new_task_gen("subst",
source = binary_subst_file,
- target = "data/kupfer",
+ target = "bin/kupfer",
install_path = "${BINDIR}",
chmod = 0755,
dict = _dict_slice(bld.env, "PYTHON PYTHONDIR".split())
)
+ bld.install_files("${BINDIR}", "bin/kupfer-exec", chmod=0755)
+
# Documentation
if bld.env["RST2MAN"]:
# generate man page from Quickstart.rst
@@ -214,14 +216,18 @@ def build(bld):
)
bld.add_group()
# compress and install man page
- bld.new_task_gen(
+ manpage = bld.new_task_gen(
source = "kupfer.1",
target = "kupfer.1.gz",
- rule = 'gzip -c ${SRC} > ${TGT}',
+ rule = 'gzip -9 -c ${SRC} > ${TGT}',
install_path = "${MANDIR}/man1",
)
+ man_path = Utils.subst_vars(
+ os.path.join(manpage.install_path, manpage.target),
+ bld.env)
+ bld.symlink_as("${MANDIR}/man1/kupfer-exec.1.gz", man_path)
- bld.add_subdirs("po data extras")
+ bld.add_subdirs("po auxdata data extras")
def intlupdate(util):
print "You should use intltool-update directly."
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]