summaryrefslogtreecommitdiffstats
path: root/web-gui/plot/generate.py.in
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2010-06-16 17:55:39 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2010-06-19 11:20:11 +0200
commit80a1ea6e6e524f2f49f0fc2d0884b08261bae73b (patch)
treeafb8efcd8225a047c7ad803be60d1bab8f68ae38 /web-gui/plot/generate.py.in
parent21c3f2360967138d9dfc13a3985fb92ca1c44027 (diff)
downloadjson-dbus-bridge-examples-80a1ea6e6e524f2f49f0fc2d0884b08261bae73b.tar.gz
[plot] add plot web demo
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'web-gui/plot/generate.py.in')
-rwxr-xr-xweb-gui/plot/generate.py.in72
1 files changed, 72 insertions, 0 deletions
diff --git a/web-gui/plot/generate.py.in b/web-gui/plot/generate.py.in
new file mode 100755
index 0000000..2e1f102
--- /dev/null
+++ b/web-gui/plot/generate.py.in
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+################################################################################
+#
+# qooxdoo - the new era of web development
+#
+# http://qooxdoo.org
+#
+# Copyright:
+# 2008 - 2009 1&1 Internet AG, Germany, http://www.1und1.de
+#
+# License:
+# LGPL: http://www.gnu.org/licenses/lgpl.html
+# EPL: http://www.eclipse.org/org/documents/epl-v10.php
+# See the LICENSE file in the project's top-level directory for details.
+#
+# Authors:
+# * Thomas Herchenroeder (thron7)
+#
+################################################################################
+
+##
+# This is a stub proxy for the real generator.py
+##
+
+import sys, os, re, subprocess
+
+CMD_PYTHON = 'python'
+QOOXDOO_PATH = '@QOOXDOO_SDK@'
+
+def getQxPath():
+ path = QOOXDOO_PATH
+ # try updating from config file
+ if os.path.exists('config.json'):
+ # "using QOOXDOO_PATH from config.json"
+ qpathr=re.compile(r'"QOOXDOO_PATH"\s*:\s*"([^"]*)"\s*,?')
+ conffile = open('config.json')
+ aconffile = conffile.readlines()
+ for line in aconffile:
+ mo = qpathr.search(line)
+ if mo:
+ path = mo.group(1)
+ break # assume first occurrence is ok
+ path = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), path))
+
+ return path
+
+os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) # switch to skeleton dir
+qxpath = getQxPath()
+REAL_GENERATOR = os.path.join(qxpath, 'tool', 'bin', 'generator.py')
+
+if not os.path.exists(REAL_GENERATOR):
+ print "Cannot find real generator script under: \"%s\"; aborting" % REAL_GENERATOR
+ sys.exit(1)
+
+argList = []
+argList.append(CMD_PYTHON)
+argList.append(REAL_GENERATOR)
+argList.extend(sys.argv[1:])
+if sys.platform == "win32":
+ argList1=[]
+ for arg in argList:
+ if arg.find(' ')>-1:
+ argList1.append('"%s"' % arg)
+ else:
+ argList1.append(arg)
+ argList = argList1
+else:
+ argList = ['"%s"' % x for x in argList] # quote argv elements
+
+cmd = " ".join(argList)
+retval = subprocess.call(cmd, shell=True)
+sys.exit(retval)