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

Side by Side Diff: mojo/tools/mopy/paths.py

Issue 1300463002: Upload/Download dart_snapshotter (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « mojo/public/tools/download_dart_snapshotter.py ('k') | mojo/tools/upload_binaries.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os 5 import os
6 6
7 from .config import Config 7 from .config import Config
8 from .gn import BuildDirectoryForConfig 8 from .gn import BuildDirectoryForConfig
9 9
10 class Paths(object): 10 class Paths(object):
(...skipping 10 matching lines...) Expand all
21 21
22 if config: 22 if config:
23 self.build_dir = BuildDirectoryForConfig(config, self.src_root) 23 self.build_dir = BuildDirectoryForConfig(config, self.src_root)
24 elif build_dir is not None: 24 elif build_dir is not None:
25 self.build_dir = os.path.abspath(build_dir) 25 self.build_dir = os.path.abspath(build_dir)
26 else: 26 else:
27 self.build_dir = None 27 self.build_dir = None
28 28
29 if self.build_dir is not None: 29 if self.build_dir is not None:
30 self.mojo_shell_path = os.path.join(self.build_dir, "mojo_shell") 30 self.mojo_shell_path = os.path.join(self.build_dir, "mojo_shell")
31 self.dart_snapshotter_path = os.path.join(
32 self.build_dir, "dart_snapshotter")
31 self.sky_shell_path = os.path.join(self.build_dir, "sky_shell") 33 self.sky_shell_path = os.path.join(self.build_dir, "sky_shell")
32 # TODO(vtl): Use the host OS here, since |config| may not be available. 34 # TODO(vtl): Use the host OS here, since |config| may not be available.
33 # In any case, if the target is Windows, but the host isn't, using 35 # In any case, if the target is Windows, but the host isn't, using
34 # |os.path| isn't correct.... 36 # |os.path| isn't correct....
35 if Config.GetHostOS() == Config.OS_WINDOWS: 37 if Config.GetHostOS() == Config.OS_WINDOWS:
36 self.mojo_shell_path += ".exe" 38 self.mojo_shell_path += ".exe"
37 self.sky_shell_path += ".exe" 39 self.sky_shell_path += ".exe"
40 self.dart_snapshotter_path += ".exe"
38 if config and config.target_os == Config.OS_ANDROID: 41 if config and config.target_os == Config.OS_ANDROID:
39 self.target_mojo_shell_path = os.path.join(self.build_dir, 42 self.target_mojo_shell_path = os.path.join(self.build_dir,
40 "apks", 43 "apks",
41 "MojoShell.apk") 44 "MojoShell.apk")
45 # dart_snapshotter only runs on the host platform. There is no build to
46 # run on Android.
47 self.target_dart_snapshotter_path = None
42 self.target_sky_shell_path = os.path.join(self.build_dir, 48 self.target_sky_shell_path = os.path.join(self.build_dir,
43 "apks", 49 "apks",
44 "SkyDemo.apk") 50 "SkyDemo.apk")
45 else: 51 else:
46 self.target_mojo_shell_path = self.mojo_shell_path 52 self.target_mojo_shell_path = self.mojo_shell_path
53 self.target_dart_snapshotter_path = self.dart_snapshotter_path
47 self.target_sky_shell_path = self.sky_shell_path 54 self.target_sky_shell_path = self.sky_shell_path
48 else: 55 else:
49 self.mojo_shell_path = None 56 self.mojo_shell_path = None
57 self.dart_snapshotter_path = None
50 self.sky_shell_path = None 58 self.sky_shell_path = None
51 self.target_mojo_shell_path = None 59 self.target_mojo_shell_path = None
60 self.target_dart_snapshotter_path = None
52 self.target_sky_shell_path = None 61 self.target_sky_shell_path = None
53 62
54 def RelPath(self, path): 63 def RelPath(self, path):
55 """Returns the given path, relative to the current directory.""" 64 """Returns the given path, relative to the current directory."""
56 return os.path.relpath(path) 65 return os.path.relpath(path)
57 66
58 def SrcRelPath(self, path): 67 def SrcRelPath(self, path):
59 """Returns the given path, relative to self.src_root.""" 68 """Returns the given path, relative to self.src_root."""
60 return os.path.relpath(path, self.src_root) 69 return os.path.relpath(path, self.src_root)
61 70
62 def FileFromUrl(self, url): 71 def FileFromUrl(self, url):
63 """Given an app URL (<scheme>:<appname>), return 'build_dir/appname.mojo'. 72 """Given an app URL (<scheme>:<appname>), return 'build_dir/appname.mojo'.
64 If self.build_dir is None, just return appname.mojo 73 If self.build_dir is None, just return appname.mojo
65 """ 74 """
66 (_, name) = url.split(':') 75 (_, name) = url.split(':')
67 if self.build_dir: 76 if self.build_dir:
68 return os.path.join(self.build_dir, name + '.mojo') 77 return os.path.join(self.build_dir, name + '.mojo')
69 return name + '.mojo' 78 return name + '.mojo'
70 79
71 @staticmethod 80 @staticmethod
72 def IsValidAppUrl(url): 81 def IsValidAppUrl(url):
73 """Returns False if url is malformed, True otherwise.""" 82 """Returns False if url is malformed, True otherwise."""
74 try: 83 try:
75 return len(url.split(':')) == 2 84 return len(url.split(':')) == 2
76 except ValueError: 85 except ValueError:
77 return False 86 return False
OLDNEW
« no previous file with comments | « mojo/public/tools/download_dart_snapshotter.py ('k') | mojo/tools/upload_binaries.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698