1 | #!/usr/bin/env python |
---|
2 | ################################################################################ |
---|
3 | # |
---|
4 | # qooxdoo - the new era of web development |
---|
5 | # |
---|
6 | # http://qooxdoo.org |
---|
7 | # |
---|
8 | # Copyright: |
---|
9 | # 2008 - 2009 1&1 Internet AG, Germany, http://www.1und1.de |
---|
10 | # |
---|
11 | # License: |
---|
12 | # LGPL: http://www.gnu.org/licenses/lgpl.html |
---|
13 | # EPL: http://www.eclipse.org/org/documents/epl-v10.php |
---|
14 | # See the LICENSE file in the project's top-level directory for details. |
---|
15 | # |
---|
16 | # Authors: |
---|
17 | # * Thomas Herchenroeder (thron7) |
---|
18 | # |
---|
19 | ################################################################################ |
---|
20 | |
---|
21 | ## |
---|
22 | # This is a stub proxy for the real generator.py |
---|
23 | ## |
---|
24 | |
---|
25 | import sys, os, re, subprocess |
---|
26 | |
---|
27 | CMD_PYTHON = 'python' |
---|
28 | QOOXDOO_PATH = '' |
---|
29 | |
---|
30 | def getQxPath(): |
---|
31 | path = QOOXDOO_PATH |
---|
32 | # try updating from config file |
---|
33 | if os.path.exists('config.json'): |
---|
34 | # "using QOOXDOO_PATH from config.json" |
---|
35 | qpathr=re.compile(r'"QOOXDOO_PATH"\s*:\s*"([^"]*)"\s*,?') |
---|
36 | conffile = open('config.json') |
---|
37 | aconffile = conffile.readlines() |
---|
38 | for line in aconffile: |
---|
39 | mo = qpathr.search(line) |
---|
40 | if mo: |
---|
41 | path = mo.group(1) |
---|
42 | break # assume first occurrence is ok |
---|
43 | path = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), path)) |
---|
44 | |
---|
45 | return path |
---|
46 | |
---|
47 | os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) # switch to skeleton dir |
---|
48 | qxpath = getQxPath() |
---|
49 | REAL_GENERATOR = os.path.join(qxpath, 'tool', 'bin', 'generator.py') |
---|
50 | |
---|
51 | if not os.path.exists(REAL_GENERATOR): |
---|
52 | print "Cannot find real generator script under: \"%s\"; aborting" % REAL_GENERATOR |
---|
53 | sys.exit(1) |
---|
54 | |
---|
55 | argList = [] |
---|
56 | argList.append(CMD_PYTHON) |
---|
57 | argList.append(REAL_GENERATOR) |
---|
58 | argList.extend(sys.argv[1:]) |
---|
59 | if sys.platform == "win32": |
---|
60 | argList1=[] |
---|
61 | for arg in argList: |
---|
62 | if arg.find(' ')>-1: |
---|
63 | argList1.append('"%s"' % arg) |
---|
64 | else: |
---|
65 | argList1.append(arg) |
---|
66 | argList = argList1 |
---|
67 | else: |
---|
68 | argList = ['"%s"' % x for x in argList] # quote argv elements |
---|
69 | |
---|
70 | cmd = " ".join(argList) |
---|
71 | retval = subprocess.call(cmd, shell=True) |
---|
72 | sys.exit(retval) |
---|