Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: mojo/tools/mojo_demo.py

Issue 990493002: Make package: work like Dart expects in preparation for a Sky SDK (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Works Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 from mopy.config import Config 6 from mopy.config import Config
7 import argparse 7 import argparse
8 import mopy.paths 8 import mopy.paths
9 import os 9 import os
10 import pipes 10 import pipes
(...skipping 18 matching lines...) Expand all
29 29
30 config = Config(target_os=Config.OS_LINUX, is_debug=True) 30 config = Config(target_os=Config.OS_LINUX, is_debug=True)
31 paths = mopy.paths.Paths(config, build_dir=args.build_dir) 31 paths = mopy.paths.Paths(config, build_dir=args.build_dir)
32 mojo_shell = paths.mojo_shell_path 32 mojo_shell = paths.mojo_shell_path
33 33
34 cmd = [mojo_shell] 34 cmd = [mojo_shell]
35 cmd.append('--v=1') 35 cmd.append('--v=1')
36 36
37 HTTP_PORT = 9999 37 HTTP_PORT = 9999
38 configuration = 'Debug' if config.is_debug else 'Release' 38 configuration = 'Debug' if config.is_debug else 'Release'
39 server = SkyServer(HTTP_PORT, configuration, paths.src_root) 39 packages_root = os.path.join(paths.build_dir, 'gen')
40 server = SkyServer(HTTP_PORT, configuration, paths.src_root, packages_root)
40 41
41 if args.demo == 'browser': 42 if args.demo == 'browser':
42 base_url = server.path_as_url(paths.build_dir) 43 base_url = server.path_as_url(paths.build_dir)
43 wm_url = os.path.join(base_url, 'example_window_manager.mojo') 44 wm_url = os.path.join(base_url, 'example_window_manager.mojo')
44 browser_url = os.path.join(base_url, 'browser.mojo') 45 browser_url = os.path.join(base_url, 'browser.mojo')
45 cmd.append('--url-mappings=mojo:window_manager=mojo:example_window_manager') 46 cmd.append('--url-mappings=mojo:window_manager=mojo:example_window_manager')
46 cmd.append('--args-for=mojo:window_manager %s' % (wm_url)) 47 cmd.append('--args-for=mojo:window_manager %s' % (wm_url))
47 cmd.append('--args-for=mojo:browser %s' % (browser_url)) 48 cmd.append('--args-for=mojo:browser %s' % (browser_url))
48 cmd.append('mojo:window_manager') 49 cmd.append('mojo:window_manager')
49 elif args.demo == 'wm_flow': 50 elif args.demo == 'wm_flow':
(...skipping 13 matching lines...) Expand all
63 64
64 # http://stackoverflow.com/questions/4748344/whats-the-reverse-of-shlex-split 65 # http://stackoverflow.com/questions/4748344/whats-the-reverse-of-shlex-split
65 # shlex.quote doesn't exist until 3.3 66 # shlex.quote doesn't exist until 3.3
66 # This doesn't print exactly what we want, but it's better than nothing: 67 # This doesn't print exactly what we want, but it's better than nothing:
67 print " ".join(map(pipes.quote, cmd)) 68 print " ".join(map(pipes.quote, cmd))
68 with server: 69 with server:
69 return subprocess.call(cmd) 70 return subprocess.call(cmd)
70 71
71 if __name__ == '__main__': 72 if __name__ == '__main__':
72 sys.exit(main()) 73 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698