| 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 self.boringssl_path = os.path.join(self.src_root, 'third_party', |
| 22 'boringssl') |
| 21 | 23 |
| 22 self.go_tool_path = None | 24 self.go_tool_path = None |
| 23 if config: | 25 if config: |
| 24 if (config.target_os == Config.OS_LINUX and | 26 if (config.target_os == Config.OS_LINUX and |
| 25 config.target_cpu == Config.ARCH_X64): | 27 config.target_cpu == Config.ARCH_X64): |
| 26 self.go_tool_path = os.path.join(self.src_root, "third_party", | 28 self.go_tool_path = os.path.join(self.src_root, "third_party", |
| 27 "go", "tool", "linux_amd64", "bin", "go") | 29 "go", "tool", "linux_amd64", "bin", "go") |
| 28 elif config.target_os == Config.OS_ANDROID: | 30 elif config.target_os == Config.OS_ANDROID: |
| 29 self.go_tool_path = os.path.join(self.src_root, "third_party", | 31 self.go_tool_path = os.path.join(self.src_root, "third_party", |
| 30 "go", "tool", "android_arm", "bin", "go") | 32 "go", "tool", "android_arm", "bin", "go") |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 return os.path.join(self.build_dir, name + '.mojo') | 95 return os.path.join(self.build_dir, name + '.mojo') |
| 94 return name + '.mojo' | 96 return name + '.mojo' |
| 95 | 97 |
| 96 @staticmethod | 98 @staticmethod |
| 97 def IsValidAppUrl(url): | 99 def IsValidAppUrl(url): |
| 98 """Returns False if url is malformed, True otherwise.""" | 100 """Returns False if url is malformed, True otherwise.""" |
| 99 try: | 101 try: |
| 100 return len(url.split(':')) == 2 | 102 return len(url.split(':')) == 2 |
| 101 except ValueError: | 103 except ValueError: |
| 102 return False | 104 return False |
| OLD | NEW |