PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/versions/v2/apps/osgi-bundles/dsp/DSPManagement/web/DSP Management/generate.py

http://netbeams.googlecode.com/
Python | 71 lines | 38 code | 9 blank | 24 comment | 10 complexity | 28217ef4cd7c563349dbb4f0d8eea06d MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  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 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. # This is a stub proxy for the real generator.py
  22. ##
  23. import sys, os, re, subprocess
  24. CMD_PYTHON = 'python'
  25. QOOXDOO_PATH = '../../../../../../../../../qooxdoo-0.8.1-sdk'
  26. def getQxPath():
  27. path = QOOXDOO_PATH
  28. # try updating from config file
  29. if os.path.exists('config.json'):
  30. # "using QOOXDOO_PATH from config.json"
  31. qpathr=re.compile(r'"QOOXDOO_PATH"\s*:\s*"([^"]*)"\s*,')
  32. conffile = open('config.json')
  33. aconffile = conffile.readlines()
  34. for line in aconffile:
  35. mo = qpathr.search(line)
  36. if mo:
  37. path = mo.group(1)
  38. break # assume first occurance is ok
  39. path = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), path))
  40. return path
  41. os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) # switch to skeleton dir
  42. qxpath = getQxPath()
  43. REAL_GENERATOR = os.path.join(qxpath, 'tool', 'bin', 'generator.py')
  44. if not os.path.exists(REAL_GENERATOR):
  45. print "Cannot find real generator script under: \"%s\"; aborting" % REAL_GENERATOR
  46. sys.exit(1)
  47. argList = []
  48. argList.append(CMD_PYTHON)
  49. argList.append(REAL_GENERATOR)
  50. argList.extend(sys.argv[1:])
  51. if sys.platform == "win32":
  52. argList1=[]
  53. for arg in argList:
  54. if arg.find(' ')>-1:
  55. argList1.append('"%s"' % arg)
  56. else:
  57. argList1.append(arg)
  58. argList = argList1
  59. else:
  60. argList = ['"%s"' % x for x in argList] # quote argv elements
  61. cmd = " ".join(argList)
  62. subprocess.call(cmd, shell=True)