aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorGergely Risko <ext-risko.gergely@nokia.com>2009-05-29 10:16:16 +0300
committerGergely Risko <ext-risko.gergely@nokia.com>2009-05-29 10:16:16 +0300
commit6fee36f018e681ec27cd73f4141c59e189941467 (patch)
treef0e61130bc294623c17502ec011b2bc89570bb2c /python
parentd889232c0f18ec30ed7585ae93ddfdc15a8bd381 (diff)
python/flexiprovider: CONTEXT_FLEXI_XML -> CONTEXT_PROVIDE_REGISTRY_FILE
Diffstat (limited to 'python')
-rw-r--r--python/ContextKit/flexiprovider.py14
-rw-r--r--python/context-provide.110
2 files changed, 13 insertions, 11 deletions
diff --git a/python/ContextKit/flexiprovider.py b/python/ContextKit/flexiprovider.py
index edb63301..c85aedad 100644
--- a/python/ContextKit/flexiprovider.py
+++ b/python/ContextKit/flexiprovider.py
@@ -41,14 +41,16 @@ def xmlfor(busname='ctx.flexiprovider', bus='session', *props):
return '\n'.join(xml)
def update_context_providers(xml, dir='.'):
- """Dumps the xml into $dir/flexi-properties.xml."""
- tmpfd, tmpfn = tempfile.mkstemp('.xml', 'flexi', dir)
+ """Dumps the xml into $dir/context-provide.context."""
+ if "CONTEXT_PROVIDE_REGISTRY_FILE" in os.environ:
+ outfilename = os.environ["CONTEXT_PROVIDE_REGISTRY_FILE"]
+ else:
+ outfilename = dir + '/context-provide.context'
+ tmpdir = outfilename[:outfilename.rindex('/')]
+ tmpfd, tmpfn = tempfile.mkstemp('.context', 'context-provide-', tmpdir)
os.write(tmpfd, xml)
os.close(tmpfd)
- if "CONTEXT_FLEXI_XML" in os.environ:
- os.rename(tmpfn, os.environ["CONTEXT_FLEXI_XML"])
- else:
- os.rename(tmpfn, dir + '/flexi-properties.xml')
+ os.rename(tmpfn, outfilename)
class Flexiprovider(object):
def stdin_ready(self, fd, cond):
diff --git a/python/context-provide.1 b/python/context-provide.1
index 2bd1daa6..f547ef8e 100644
--- a/python/context-provide.1
+++ b/python/context-provide.1
@@ -23,11 +23,11 @@ with these triplets you can define initial properties. Type can be one of int,
double, truth.
.SH ENVIRONMENT VARIABLES
.TP 8
-CONTEXT_FLEXI_XML
-points to a directory, which will be used to output the
-flexi-properties.xml, which contains the definition of the added
-properties (either via commands or arguments). If not defined, the
-xml will go to the current directory.
+CONTEXT_PROVIDE_REGISTRY_FILE
+path to output the definitions of the added properties (either via
+commands or arguments). If not defined, the definitions will go
+to ./context-provide.xml.
+
.SH COMMAND LINE INTERFACE
The interactive mode stops on closing stdin, and supports the following
commands (note that this is Python syntax, and it gets eval()-ed):