Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 import os | 7 import os |
| 8 import cherrypy | 8 import cherrypy |
| 9 | 9 |
| 10 | |
| 10 BUILD_DIRECTORY = 'out' | 11 BUILD_DIRECTORY = 'out' |
| 11 CONFIG_DIRECTORY = 'Debug' | 12 CONFIG_DIRECTORY = 'Debug' |
| 12 GEN_DIRECTORY = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, | 13 SRC_ROOT = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, |
| 13 os.pardir, BUILD_DIRECTORY, CONFIG_DIRECTORY, 'gen')) | 14 os.pardir)) |
| 15 SKY_ROOT = os.path.join(SRC_ROOT, 'sky') | |
| 16 GEN_ROOT = os.path.join(SRC_ROOT, BUILD_DIRECTORY, CONFIG_DIRECTORY, 'gen') | |
| 17 | |
| 14 | 18 |
| 15 # FIXME: This doesn't yet support directory listings. We'll do something like: | 19 # FIXME: This doesn't yet support directory listings. We'll do something like: |
| 16 # http://tools.cherrypy.org/wiki/staticdirindex | 20 # http://tools.cherrypy.org/wiki/staticdirindex |
| 17 # but have it spit .sky instead of HTML | 21 # but have it spit .sky instead of HTML |
| 18 | 22 |
| 19 def main(): | 23 def main(): |
| 20 parser = argparse.ArgumentParser(description='Sky development server') | 24 parser = argparse.ArgumentParser(description='Sky development server') |
| 21 parser.add_argument('app_path', type=str) | 25 parser.add_argument('app_path', type=str) |
| 22 parser.add_argument('port', type=int) | 26 parser.add_argument('port', type=int) |
| 23 args = parser.parse_args() | 27 args = parser.parse_args() |
| 28 print os.path.abspath(args.app_path) | |
|
abarth-chromium
2014/10/28 20:16:43
Spurious?
| |
| 24 | 29 |
| 25 config = { | 30 config = { |
| 26 'global': { | 31 'global': { |
| 27 'server.socket_port': args.port, | 32 'server.socket_port': args.port, |
| 28 }, | 33 }, |
| 29 '/': { | 34 '/': { |
| 30 'tools.staticdir.on': True, | 35 'tools.staticdir.on': True, |
| 31 'tools.staticdir.dir': os.path.abspath(args.app_path), | 36 'tools.staticdir.dir': os.path.abspath(args.app_path), |
| 32 }, | 37 }, |
| 38 '/mojo': { | |
| 39 'tools.staticdir.on': True, | |
| 40 'tools.staticdir.dir': os.path.join(GEN_ROOT, 'mojo'), | |
| 41 }, | |
| 33 '/sky': { | 42 '/sky': { |
| 34 'tools.staticdir.on': True, | 43 'tools.staticdir.on': True, |
| 35 'tools.staticdir.dir': os.path.join(GEN_DIRECTORY, 'sky'), | 44 'tools.staticdir.dir': os.path.join(GEN_ROOT, 'sky'), |
| 36 }, | 45 }, |
| 37 '/mojo': { | 46 # src-relative to avoid needing to rebuild when changing inspector: |
| 47 '/sky/framework': { | |
| 38 'tools.staticdir.on': True, | 48 'tools.staticdir.on': True, |
| 39 'tools.staticdir.dir': os.path.join(GEN_DIRECTORY, 'mojo'), | 49 'tools.staticdir.dir': |
| 40 } | 50 os.path.join(SKY_ROOT, 'framework'), |
| 51 }, | |
| 52 '/sky/framework/inspector/server': { | |
| 53 'tools.staticdir.on': True, | |
| 54 'tools.staticdir.dir': os.path.join(GEN_ROOT, 'sky', 'framework', | |
| 55 'inspector', 'server'), | |
| 56 }, | |
| 41 } | 57 } |
| 42 cherrypy.quickstart(config=config) | 58 cherrypy.quickstart(config=config) |
| 43 | 59 |
| 44 | 60 |
| 45 if __name__ == '__main__': | 61 if __name__ == '__main__': |
| 46 main() | 62 main() |
| OLD | NEW |