source: generate.py @ 260:d59c8b1f1f44

Last change on this file since 260:d59c8b1f1f44 was 139:5fd6d4687c96, checked in by fnevgeny, 15 years ago

generate.py from qx-1.0.

  • Property exe set to *
File size: 2.0 KB
Line 
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
25import sys, os, re, subprocess
26
27CMD_PYTHON = 'python'
28QOOXDOO_PATH = ''
29
30def 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
47os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))  # switch to skeleton dir
48qxpath = getQxPath()
49REAL_GENERATOR = os.path.join(qxpath, 'tool', 'bin', 'generator.py')
50
51if not os.path.exists(REAL_GENERATOR):
52    print "Cannot find real generator script under: \"%s\"; aborting" % REAL_GENERATOR
53    sys.exit(1)
54
55argList = []
56argList.append(CMD_PYTHON)
57argList.append(REAL_GENERATOR)
58argList.extend(sys.argv[1:])
59if 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
67else:
68    argList = ['"%s"' % x for x in argList]  # quote argv elements
69   
70cmd = " ".join(argList)
71retval = subprocess.call(cmd, shell=True)
72sys.exit(retval)
Note: See TracBrowser for help on using the repository browser.