aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorGergely Risko <ext-risko.gergely@nokia.com>2009-05-28 14:07:00 +0300
committerGergely Risko <ext-risko.gergely@nokia.com>2009-05-28 14:07:00 +0300
commit23ef92baee11a8bf0c00f39fb424424f8d2be050 (patch)
tree225941a127849f8e3b98ee12e605804d185a9357 /python
parentc01dbf79fb55edea8dbadd0209ecb7a19a5fdd02 (diff)
python/flexiprovider: scratchbox + device fixes, documentation update
Signed-off-by: Marja Hassinen <ext-marja.2.hassinen@nokia.com>
Diffstat (limited to 'python')
-rw-r--r--python/ContextKit/ContextProvider.py2
-rw-r--r--python/ContextKit/flexiprovider.py38
-rw-r--r--python/context-provide.17
3 files changed, 9 insertions, 38 deletions
diff --git a/python/ContextKit/ContextProvider.py b/python/ContextKit/ContextProvider.py
index 6e8f61fd..45111208 100644
--- a/python/ContextKit/ContextProvider.py
+++ b/python/ContextKit/ContextProvider.py
@@ -2,7 +2,7 @@ from ctypes import *
from CTypesHelpers import *
-_dll = CDLL("libcontextprovider.so")
+_dll = CDLL("libcontextprovider.so.0")
class ContextProvider:
SUBSCRIPTION_CHANGED_CALLBACK = CFUNCTYPE(None, c_int, c_void_p)
diff --git a/python/ContextKit/flexiprovider.py b/python/ContextKit/flexiprovider.py
index 40c8ed09..edb63301 100644
--- a/python/ContextKit/flexiprovider.py
+++ b/python/ContextKit/flexiprovider.py
@@ -5,43 +5,7 @@ import tempfile
import subprocess
import gobject
import dbus, dbus.service, dbus.mainloop.glib
-
-def pkgconfig(*args):
- """Runs `pkg-config $args` and returns the Popen object, augmented
- with an `output' attribute containing stdout."""
- cmd = ['pkg-config'] + list(args)
- process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
- process.output = process.communicate()[0].strip()
- return process
-
-# The following kludge is needed if we want this to be usable without
-# installing libcontextprovider. If pkg-config reports it as
-# uninstalled, we extend PYTHONPATH, then we try to import the module.
-# If that fails, extend LD_LIBRARY_PATH and re-exec ourselves.
-
-if pkgconfig('--exists', 'contextprovider-1.0').returncode != 0:
- raise RuntimeError("You need to make pkg-config find "
- "contextprovider-1.0 somehow. \n"
- "Try setting $PKG_CONFIG_PATH.")
-
-if pkgconfig('--uninstalled', 'contextprovider-1.0').returncode == 0:
- sys.path.append(pkgconfig('--variable=pythondir', 'contextprovider-1.0').output)
-try:
- import ContextProvider as CP
-except ImportError:
- raise
-except:
- # Failed, probably because LD_LIBRARY_PATH is not right. Set it and
- # re-exec ourselves. To avoid an infinite loop, we try this only
- # when LD_LIBRARY_PATH doesn't yet contain what we want to add.
- libdir = pkgconfig('--variable=libdir', 'contextprovider-1.0').output
- ldpath = [d for d in os.environ.get('LD_LIBRARY_PATH', '').split(':') if d != '']
- if libdir in ldpath:
- raise
- ldpath += [libdir, libdir + '/.libs']
- env = dict(os.environ)
- env.update(LD_LIBRARY_PATH=':'.join(ldpath))
- os.execve(sys.argv[0], sys.argv, env)
+import ContextProvider as CP
class _property(object):
"""Kind-of a template for property types."""
diff --git a/python/context-provide.1 b/python/context-provide.1
index 34f89399..2bd1daa6 100644
--- a/python/context-provide.1
+++ b/python/context-provide.1
@@ -62,5 +62,12 @@ add some through the command line interface:
set('example.string', 'value2')
set('example.int', None)
+.SH RUNNING IN SCRATCHBOX
+Inside scratchbox the default python version currently is 2.3, but
+context-provide needs 2.5, so you have to run it like this:
+ python2.5 /usr/bin/context-provide
+
+You can check the current python version with python -V
+
.SH SEE ALSO
context-listen(1)