コード例 #1
0
  def testLinux(self):
    self.make_file_tree({'.gclient': '', 'buildtools': ''})
    sys.platform = 'linux'

    self.assertEqual(
        os.path.join(self.root, 'buildtools', 'linux64'),
        gclient_paths.GetBuildtoolsPlatformBinaryPath())
コード例 #2
0
  def testMac(self):
    self.make_file_tree({'.gclient': '', 'buildtools': ''})
    sys.platform = 'darwin'

    self.assertEqual(
        os.path.join(self.root, 'buildtools', 'mac'),
        gclient_paths.GetBuildtoolsPlatformBinaryPath())
コード例 #3
0
ファイル: gn.py プロジェクト: Andrewou2010/webview
def main(args):
    # Prune all evidence of VPython/VirtualEnv out of the environment. This means
    # that we 'unwrap' vpython VirtualEnv path/env manipulation. Invocations of
    # `python` from GN should never inherit the gn.py's own VirtualEnv. This also
    # helps to ensure that generated ninja files do not reference python.exe from
    # the VirtualEnv generated from depot_tools' own .vpython file (or lack
    # thereof), but instead reference the default python from the PATH.
    PruneVirtualEnv()

    # Try in primary solution location first, with the gn binary having been
    # downloaded by cipd in the projects DEPS.
    primary_solution_path = gclient_paths.GetPrimarySolutionPath()
    if primary_solution_path:
        gn_path = os.path.join(primary_solution_path, 'third_party', 'gn',
                               'gn' + gclient_paths.GetExeSuffix())
        if os.path.exists(gn_path):
            return subprocess.call([gn_path] + args[1:])

    # Otherwise try the old .sha1 and download_from_google_storage locations
    # inside of buildtools.
    bin_path = gclient_paths.GetBuildtoolsPlatformBinaryPath()
    if not bin_path:
        print(
            'gn.py: Could not find checkout in any parent of the current path.\n'
            'This must be run inside a checkout.',
            file=sys.stderr)
        return 1
    gn_path = os.path.join(bin_path, 'gn' + gclient_paths.GetExeSuffix())
    if not os.path.exists(gn_path):
        print('gn.py: Could not find gn executable at: %s' % gn_path,
              file=sys.stderr)
        return 2
    else:
        return subprocess.call([gn_path] + args[1:])
コード例 #4
0
def init():
    global _clang_format_command_path
    global _gn_command_path

    # //buildtools/<platform>/clang-format
    command_name = "clang-format{}".format(gclient_paths.GetExeSuffix())
    command_path = os.path.abspath(
        os.path.join(gclient_paths.GetBuildtoolsPlatformBinaryPath(),
                     command_name))
    _clang_format_command_path = command_path

    # //buildtools/<platform>/gn
    command_name = "gn{}".format(gclient_paths.GetExeSuffix())
    command_path = os.path.abspath(
        os.path.join(gclient_paths.GetBuildtoolsPlatformBinaryPath(),
                     command_name))
    _gn_command_path = command_path
コード例 #5
0
ファイル: clang_format.py プロジェクト: ffzwadd/depot_tools
def FindClangFormatToolInChromiumTree():
  """Return a path to the clang-format executable, or die trying."""
  bin_path = gclient_paths.GetBuildtoolsPlatformBinaryPath()
  if not bin_path:
    raise NotFoundError(
        'Could not find checkout in any parent of the current path.\n'
        'Set CHROMIUM_BUILDTOOLS_PATH to use outside of a chromium checkout.')

  tool_path = os.path.join(bin_path,
                           'clang-format' + gclient_paths.GetExeSuffix())
  if not os.path.exists(tool_path):
    raise NotFoundError('File does not exist: %s' % tool_path)
  return tool_path
コード例 #6
0
  def testError(self):
    self.make_file_tree({'.gclient': '', 'buildtools': ''})
    sys.platform = 'foo'

    with self.assertRaises(gclient_utils.Error, msg='Unknown platform: foo'):
      gclient_paths.GetBuildtoolsPlatformBinaryPath()
コード例 #7
0
 def testNoBuildtoolsPath(self):
   self.make_file_tree({'.gclient': ''})
   self.cwd = os.path.join(self.root, 'foo', 'bar')
   self.assertIsNone(gclient_paths.GetBuildtoolsPlatformBinaryPath())