[kupfer] Start kupfer with kupfer.py
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] Start kupfer with kupfer.py
- Date: Mon, 2 Nov 2009 22:13:05 +0000 (UTC)
commit b0b689753f959e493f1cd74a5e2d78fe0609dd93
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Mon Nov 2 02:13:33 2009 +0100
Start kupfer with kupfer.py
We make a script kupfer.py that will always be used to start kupfer.
This script is placed inside $PYTHONDIR, and we save a reference to
PYTHONDIR in the kupfer-activate.sh script, so that we can find where
the kupfer Python package is installed.
With this change, it is possible to install kupfer's python package
anywhere, for example inside $DATADIR/kupfer like the Debian package
for Kupfer does. That way, we don't have any issues with collisions
with other system packages, or Python's sys.path at all.
kupfer-activate.sh | 4 +++-
kupfer.py | 22 ++++++++++++++++++++++
kupfer/__init__.py | 22 ----------------------
wscript | 12 ++++++++++--
4 files changed, 35 insertions(+), 25 deletions(-)
---
diff --git a/kupfer-activate.sh b/kupfer-activate.sh
index 3fe99a7..2cc484a 100755
--- a/kupfer-activate.sh
+++ b/kupfer-activate.sh
@@ -1,7 +1,9 @@
#!/bin/bash
PYTHON="@PYTHON@"
+PYTHONDIR="@PYTHONDIR@"
test ${PYTHON:0:1} = "@" && PYTHON=python
+test ${PYTHONDIR:0:1} = "@" && PYTHONDIR=$(dirname $0)
# Try to spawn kupfer via dbus, else go to python
@@ -32,7 +34,7 @@ fi
if test $KUPFER_RUNNING != 0
then
- exec ${PYTHON} -m kupfer.__init__ $*
+ exec ${PYTHON} "$PYTHONDIR/kupfer.py" $*
fi
${PYTHON} -c "import gtk.gdk; gtk.gdk.notify_startup_complete()"
diff --git a/kupfer.py b/kupfer.py
new file mode 100644
index 0000000..439e389
--- /dev/null
+++ b/kupfer.py
@@ -0,0 +1,22 @@
+"""
+kupfer A convenient access and command tool
+
+Copyright 2007--2009 Ulrik Sverdrup <ulrik sverdrup gmail com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 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 General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+if __name__ == '__main__':
+ from kupfer import main
+ main.main()
diff --git a/kupfer/__init__.py b/kupfer/__init__.py
index 439e389..e69de29 100644
--- a/kupfer/__init__.py
+++ b/kupfer/__init__.py
@@ -1,22 +0,0 @@
-"""
-kupfer A convenient access and command tool
-
-Copyright 2007--2009 Ulrik Sverdrup <ulrik sverdrup gmail com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 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 General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""
-
-if __name__ == '__main__':
- from kupfer import main
- main.main()
diff --git a/wscript b/wscript
index 7a480dc..80e471f 100644
--- a/wscript
+++ b/wscript
@@ -157,6 +157,9 @@ def _find_packages_in_directory(bld, name):
if "__init__.py" in filenames:
_new_package(bld, dirname)
+def _dict_slice(D, keys):
+ return dict((k,D[k]) for k in keys)
+
def build(bld):
# always read new version
bld.env["VERSION"] = VERSION
@@ -166,7 +169,12 @@ def build(bld):
source=version_subst_file + ".in",
target=version_subst_file,
install_path="${PYTHONDIR}/kupfer",
- dict = bld.env,
+ dict = _dict_slice(bld.env,"VERSION DATADIR PACKAGE LOCALEDIR".split())
+ )
+
+ obj = bld.new_task_gen(
+ source="kupfer.py",
+ install_path="${PYTHONDIR}"
)
# Add all Python packages recursively
@@ -182,7 +190,7 @@ def build(bld):
target = "data/kupfer",
install_path = "${BINDIR}",
chmod = 0755,
- dict = {"PYTHON": bld.env["PYTHON"]}
+ dict = _dict_slice(bld.env, "PYTHON PYTHONDIR".split())
)
# Documentation
if bld.env["RST2MAN"]:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]