OLD | NEW |
---|---|
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): |
11 """Provides commonly used paths""" | 11 """Provides commonly used paths""" |
12 | 12 |
13 def __init__(self, config=None, build_dir=None): | 13 def __init__(self, config=None, build_dir=None): |
14 """Specify either a config or a build_dir to generate paths to binary | 14 """Specify either a config or a build_dir to generate paths to binary |
15 artifacts.""" | 15 artifacts.""" |
16 self.src_root = os.path.abspath(os.path.join(__file__, | 16 self.src_root = os.path.abspath(os.path.join(__file__, |
17 os.pardir, os.pardir, os.pardir, os.pardir)) | 17 os.pardir, os.pardir, os.pardir, os.pardir)) |
18 self.mojo_dir = os.path.join(self.src_root, "mojo") | 18 self.mojo_dir = os.path.join(self.src_root, "mojo") |
19 self.adb_path = os.path.join(self.src_root, 'third_party', 'android_tools', | 19 self.adb_path = os.path.join(self.src_root, 'third_party', 'android_tools', |
20 'sdk', 'platform-tools', 'adb') | 20 'sdk', 'platform-tools', 'adb') |
21 | 21 |
22 self.go_tool_path = None | |
23 if config and config.target_os == Config.OS_LINUX: | |
viettrungluu
2015/10/09 21:39:49
Probably nest these under a single |if config:|.
rudominer
2015/10/09 23:42:06
Done.
| |
24 self.go_tool_path = os.path.join(self.src_root, "third_party", | |
25 "go", "tool", "linux_amd64", "bin", "go") | |
viettrungluu
2015/10/09 21:39:49
Probably you should also check that the target arc
rudominer
2015/10/09 23:42:06
Done.
| |
26 if config and config.target_os == Config.OS_ANDROID: | |
viettrungluu
2015/10/09 21:39:49
elif
rudominer
2015/10/09 23:42:06
Done.
| |
27 self.go_tool_path = os.path.join(self.src_root, "third_party", | |
28 "go", "tool", "android_arm", "bin", "go") | |
29 | |
22 if config: | 30 if config: |
23 self.build_dir = BuildDirectoryForConfig(config, self.src_root) | 31 self.build_dir = BuildDirectoryForConfig(config, self.src_root) |
24 elif build_dir is not None: | 32 elif build_dir is not None: |
25 self.build_dir = os.path.abspath(build_dir) | 33 self.build_dir = os.path.abspath(build_dir) |
26 else: | 34 else: |
27 self.build_dir = None | 35 self.build_dir = None |
28 | 36 |
29 if self.build_dir is not None: | 37 if self.build_dir is not None: |
30 self.mojo_shell_path = os.path.join(self.build_dir, "mojo_shell") | 38 self.mojo_shell_path = os.path.join(self.build_dir, "mojo_shell") |
31 self.dart_snapshotter_path = os.path.join( | 39 self.dart_snapshotter_path = os.path.join( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 return os.path.join(self.build_dir, name + '.mojo') | 85 return os.path.join(self.build_dir, name + '.mojo') |
78 return name + '.mojo' | 86 return name + '.mojo' |
79 | 87 |
80 @staticmethod | 88 @staticmethod |
81 def IsValidAppUrl(url): | 89 def IsValidAppUrl(url): |
82 """Returns False if url is malformed, True otherwise.""" | 90 """Returns False if url is malformed, True otherwise.""" |
83 try: | 91 try: |
84 return len(url.split(':')) == 2 | 92 return len(url.split(':')) == 2 |
85 except ValueError: | 93 except ValueError: |
86 return False | 94 return False |
OLD | NEW |